:root {
    --primary-blue: #0066cc;
    --accent-blue: #00a3ff;
    --dark-bg: #050505;
    --darker-bg: #030303;
    --text-color: #e0e0e0;
    --chat-bg: #0f0f12;
    --chat-input-bg: rgba(30, 30, 35, 0.8);
    --user-msg-bg: #004c99;
    --bot-msg-bg: #1a2c40;
}

/* ==========================================================
   Hero Title
   clamp() scales smoothly from 320px phones to 4K desktops.
   No JS, no !important, no media-query overrides needed.
   ========================================================== */
#main-title {
    font-size: clamp(2.4rem, 9vw, 9rem);
    line-height: 1.1;
    font-weight: 900;
    text-align: center;
    /* Unified gradient on desktop */
    background: linear-gradient(135deg, #ffffff 0%, #ffffff 30%, #00a3ff 75%, #0066cc 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    filter: drop-shadow(0 0 8px rgba(0, 163, 255, 0.3));
}

/* On desktop the spans inherit the parent gradient */
@media (min-width: 769px) {
    #main-title .desktop-gradient {
        background: none;
        -webkit-background-clip: initial;
        background-clip: initial;
        color: inherit;
        filter: none;
    }
}

/* On mobile: solid colours are sharper and faster to render */
@media (max-width: 768px) {
    #main-title {
        background: none;
        color: #ffffff;
        filter: none;
    }
    #main-title .desktop-gradient.text-white  { color: #ffffff; }
    #main-title .desktop-gradient.gradient-text { color: var(--accent-blue); }
}
/* .mobile-device class removed – mobile styles live exclusively in @media queries below */

/* איפוס בסיסי */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* כיוון עברית - תיקון מרכזי */
html, body {
    direction: rtl !important;
    font-family: 'Heebo', sans-serif;
    background-color: var(--dark-bg);
    color: var(--text-color);
    overflow-x: hidden;
    overflow-y: auto;
    scroll-behavior: smooth;
    min-height: 100vh;
    margin: 0;
    padding: 0;
    /* Allow vertical scrolling and panning on all devices */
    touch-action: pan-y;
    -webkit-overflow-scrolling: touch;
    scroll-padding-top: 80px;
    -webkit-tap-highlight-color: transparent;
}

/* Enhanced mobile-specific touch improvements */
@media (max-width: 768px) {
    html, body {
        touch-action: pan-y;
        -webkit-text-size-adjust: 100%;
        -ms-text-size-adjust: 100%;
    }
}

/* Enhanced smooth scrolling for all browsers */
html {
    scroll-behavior: smooth;
    scrollbar-width: thin;
    scrollbar-color: var(--accent-blue) var(--dark-bg);
}

/* Custom scrollbar for webkit browsers */
html::-webkit-scrollbar {
    width: 8px;
}

html::-webkit-scrollbar-track {
    background: var(--dark-bg);
}

html::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, var(--primary-blue), var(--accent-blue));
    border-radius: 4px;
    transition: background 0.3s ease;
}

html::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, var(--accent-blue), var(--primary-blue));
}

/* Direction is set globally; text-align is NOT forced – each component sets its own */
* {
    direction: rtl;
}

/* חריגים לאלמנט/* שיפורי עיצוב נוספים */
.window-header {
    background: rgba(20, 20, 25, 0.95);
    padding: 12px 15px;
    display: flex;
    align-items: center;
    direction: rtl;
    border-bottom: 1px solid rgba(0, 102, 204, 0.2);
}

.window-btn {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-left: 8px;
    transition: all 0.2s ease;
}

.window-btn:hover {
    transform: scale(1.1);
}

.window-content {
    padding: 20px;
    height: 280px;
    overflow-y: auto;
    direction: rtl !important;
    text-align: right !important;
    scrollbar-width: thin;
    scrollbar-color: var(--accent-blue) rgba(0,0,0,0.3);
    /* Enhanced smooth scrolling for window content */
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

.window-content::-webkit-scrollbar {
    width: 6px;
}

.window-content::-webkit-scrollbar-track {
    background: rgba(0,0,0,0.3);
    border-radius: 3px;
}

.window-content::-webkit-scrollbar-thumb {
    background: var(--accent-blue);
    border-radius: 3px;
    transition: background 0.3s ease;
}

.window-content::-webkit-scrollbar-thumb:hover {
    background: var(--primary-blue);
}

/* שיפורים לגרדיאנט */
.gradient-bg {
    background: radial-gradient(circle at 20% 40%, var(--primary-blue) 0%, rgba(0,0,0,0) 70%),
                radial-gradient(circle at 80% 80%, var(--accent-blue) 0%, rgba(0,0,0,0) 50%),
                radial-gradient(circle at 60% 20%, rgba(255, 255, 255, 0.02) 0%, rgba(0,0,0,0) 40%);
    position: absolute;
    top: 0;
    right: 0;
    width: 100%;
    height: 100%;
    opacity: 0.4;
    z-index: -1;
    animation: gradientShift 25s ease-in-out infinite;
}

@keyframes gradientShift {
    0%, 100% { 
        opacity: 0.4;
        transform: scale(1);
    }
    33% { 
        opacity: 0.6;
        transform: scale(1.05);
    }
    66% { 
        opacity: 0.3;
        transform: scale(0.95);
    }
}

/* שיפור לכותרות */
h3, h4 {
    color: #ffffff;
    margin-bottom: 0.8rem;
}

/* שיפור לטקסטים */
p {
    line-height: 1.6;
    margin-bottom: 1rem;
}

.text-lg {
    line-height: 1.7;
}

/* שיפור לרקע הכללי */
body {
    background: linear-gradient(135deg, var(--dark-bg) 0%, var(--darker-bg) 100%);
    min-height: 100vh;
    height: 100%;
    position: relative;
    z-index: 1;
    margin: 0;
    padding: 0;
}

/* שיפור לאנימציות */
.feature-slide {
    transition: all 0.3s ease;
}

.feature-slide:hover {
    transform: translateY(-2px);
}

/* שיפור לכפתורים */
button:not(.glowing-button) {
    transition: all 0.2s ease;
}

button:not(.glowing-button):hover {
    transform: translateY(-1px);
}

/* שיפור לקישורים */
a {
    transition: all 0.2s ease;
}

a:hover {
    color: var(--accent-blue);
}

/* שיפור לסקציות */
section {
    position: relative;
    z-index: 2;
}

/* שיפור לכרטיסים */
.feature-card {
    background: rgba(10, 10, 12, 0.8);
    border: 1px solid rgba(0, 102, 204, 0.3);
    border-radius: 16px;
    padding: 30px;
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
    text-align: right;
    direction: rtl;
    backdrop-filter: blur(10px);
    position: relative;
    z-index: 2;
}

.feature-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 15px 35px rgba(0, 163, 255, 0.2);
    border-color: var(--accent-blue);
    background: rgba(10, 10, 12, 0.9);
}

/* חריגים לאלמנטים שצריכים להיות במרכז */
h1, h2, .text-center, button, input, .glowing-button, .search-box, i, .fas, .fab {
    text-align: center !important;
}

/* טקסטים מיוחדים שצריכים להיות במרכז */
.text-center h3,
.text-center p,
.text-center ul {
    text-align: center !important;
}

/* רשימות במרכז */
.text-center ul li {
    text-align: center !important;
    list-style: none;
    padding-left: 0;
    padding-right: 0;
}

/* עיצובי בסיס */
.gradient-text {
    background: linear-gradient(135deg, #ffffff 0%, #00a3ff 50%, #0066cc 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    /* Enhanced glow effect */
    filter: drop-shadow(0 0 8px rgba(0, 163, 255, 0.3));
    text-shadow: none; /* Remove conflicting text-shadow */
}

/* Desktop gradient: spans inherit the H1 background-clip gradient */
@media (min-width: 769px) {
    #main-title {
        background: linear-gradient(135deg, #ffffff 0%, #ffffff 30%, #00a3ff 75%, #0066cc 100%);
        -webkit-background-clip: text;
        background-clip: text;
        color: transparent;
        filter: drop-shadow(0 0 8px rgba(0, 163, 255, 0.3));
    }
    
    .desktop-gradient.gradient-text,
    .desktop-gradient.text-white {
        background: none;
        -webkit-background-clip: initial;
        background-clip: initial;
        color: inherit;
        filter: none;
    }
}

.gradient-bg {
    background: radial-gradient(circle at 0% 40%, var(--primary-blue) 0%, rgba(0,0,0,0) 70%);
    position: absolute;
    top: 0;
    right: 0;
    width: 100%;
    height: 100%;
    opacity: 0.4;
    z-index: 0;
}

.glowing-button {
    background: linear-gradient(90deg, var(--primary-blue), var(--accent-blue));
    border: none;
    color: white;
    padding: 12px 30px;
    border-radius: 30px;
    font-weight: 600;
    letter-spacing: 0.5px;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
    box-shadow: 0 0 15px 0 rgba(0, 102, 204, 0.5);
    cursor: pointer;
    text-align: center !important;
}

.glowing-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 25px 0 rgba(0, 163, 255, 0.7);
}

.glowing-button:after {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    bottom: -50%;
    left: -50%;
    background: linear-gradient(to bottom, rgba(229, 172, 142, 0), rgba(255,255,255,0.5) 50%, rgba(229, 172, 142, 0));
    transform: rotateZ(60deg) translate(-5em, 7.5em);
    animation: shine 3s infinite;
    animation-delay: 0.5s;
    pointer-events: none;
}

@keyframes shine {
    0% { transform: rotateZ(60deg) translate(-5em, 7.5em); }
    100% { transform: rotateZ(60deg) translate(12em, -10em); }
}

/* (duplicate .feature-card definition removed) */

.feature-icon {
    color: var(--accent-blue);
    font-size: 2rem;
    margin-bottom: 1rem;
    text-align: center !important;
    display: block;
}

.search-box {
    background: rgba(30, 30, 35, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 30px;
    padding: 15px 25px;
    font-size: 1.1rem;
    color: var(--text-color);
    width: 100%;
    transition: all 0.3s ease;
    text-align: center !important;
    direction: rtl;
    backdrop-filter: blur(10px);
}

.search-box:focus {
    outline: none;
    border-color: var(--accent-blue);
    box-shadow: 0 0 15px rgba(0, 163, 255, 0.3);
    background: rgba(30, 30, 35, 0.8);
}

.search-box::placeholder {
    color: rgba(224, 224, 224, 0.6);
    text-align: center;
}

.scroll-down {
    animation: bounce 2s infinite;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-10px); }
    60% { transform: translateY(-5px); }
}

.divider {
    background: linear-gradient(90deg, transparent, var(--accent-blue), transparent);
    height: 1px;
    width: 100%;
    margin: 30px 0;
}

.parallax-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    pointer-events: none;
    z-index: -2;
    overflow: hidden;
}

.parallax-star {
    position: absolute;
    background: #ffffff;
    border-radius: 50%;
    pointer-events: none;
    animation: twinkle 3s ease-in-out infinite;
    box-shadow: 0 0 6px rgba(255, 255, 255, 0.8);
}

/* אנימציה לכוכבים נוצצים */
@keyframes twinkle {
    0%, 100% { 
        opacity: 0.3;
        transform: scale(1);
        filter: brightness(1);
    }
    25% { 
        opacity: 0.7;
        transform: scale(1.1);
        filter: brightness(1.2);
    }
    50% { 
        opacity: 1;
        transform: scale(1.2);
        filter: brightness(1.5);
    }
    75% { 
        opacity: 0.8;
        transform: scale(1.1);
        filter: brightness(1.3);
    }
}

/* כוכבים בגדלים שונים */
.parallax-star.small {
    width: 1px;
    height: 1px;
    animation-duration: 2s;
    box-shadow: 0 0 3px rgba(255, 255, 255, 0.6);
}

.parallax-star.medium {
    width: 2px;
    height: 2px;
    animation-duration: 3s;
    box-shadow: 0 0 5px rgba(255, 255, 255, 0.7);
}

.parallax-star.large {
    width: 3px;
    height: 3px;
    animation-duration: 4s;
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.9), 0 0 12px rgba(0, 163, 255, 0.3);
}

/* כוכבי יריות נדירים */
.shooting-star {
    position: absolute;
    width: 2px;
    height: 2px;
    background: linear-gradient(45deg, #ffffff, #00a3ff);
    border-radius: 50%;
    opacity: 0;
    animation: shootingStar 4s linear infinite;
    animation-delay: var(--delay);
}

@keyframes shootingStar {
    0% {
        opacity: 0;
        transform: translateX(-100px) translateY(100px) scale(0);
    }
    5% {
        opacity: 1;
        transform: translateX(-80px) translateY(80px) scale(1);
        box-shadow: 0 0 10px #ffffff, -10px 10px 20px rgba(255, 255, 255, 0.3);
    }
    15% {
        opacity: 1;
        transform: translateX(0px) translateY(0px) scale(1);
        box-shadow: 0 0 10px #ffffff, -20px 20px 30px rgba(255, 255, 255, 0.3);
    }
    25% {
        opacity: 0.8;
        transform: translateX(80px) translateY(-80px) scale(0.8);
        box-shadow: 0 0 8px #ffffff, -30px 30px 40px rgba(255, 255, 255, 0.2);
    }
    100% {
        opacity: 0;
        transform: translateX(200px) translateY(-200px) scale(0);
        box-shadow: none;
    }
}

.demo-window {
    background: rgba(15, 15, 20, 0.8);
    border: 1px solid rgba(0, 102, 204, 0.3);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0,0,0,0.4);
    direction: rtl;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
    max-width: 100%;
    position: relative;
    z-index: 1;
}

.demo-window:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 40px rgba(0, 163, 255, 0.2);
}

/* (duplicate .window-header definition removed – see the definition above) */

/* Chatbot Styles */
#chatbotToggleButton {
    position: fixed !important;
    bottom: 20px !important;
    right: 20px !important; 
    left: auto !important;
    background-color: var(--primary-blue);
    color: white;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    cursor: pointer;
    z-index: 9999 !important; /* Higher z-index to stay above everything */
    box-shadow: 0 4px 15px rgba(0, 102, 204, 0.5);
    transition: transform 0.2s ease-out, background-color 0.2s;
    border: none;
    /* Ensure it stays fixed on desktop */
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
    will-change: transform;
}

#chatbotToggleButton:hover {
    transform: scale(1.1);
    background-color: var(--accent-blue);
}

/* Desktop: Show chat button */
@media (min-width: 769px) {
    #chatbotToggleButton {
        display: flex !important;
        visibility: visible !important;
        opacity: 1 !important;
        pointer-events: auto !important;
    }
}

#chatbotContainer {
    position: fixed;
    bottom: 90px;
    right: 20px !important; 
    left: auto !important;
    width: 350px;
    max-width: 90vw;
    height: 450px;
    max-height: 70vh;
    background-color: var(--chat-bg);
    border: 1px solid rgba(0, 102, 204, 0.3);
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    z-index: 999;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    transition: opacity 0.3s ease, transform 0.3s ease;
    direction: rtl; 
}

#chatbotContainer.active {
    opacity: 1;
    transform: translateY(0) scale(1);
}

#chatbotHeader {
    background: rgba(20, 20, 25, 0.9);
    padding: 12px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--text-color);
    font-weight: bold;
    border-bottom: 1px solid rgba(0, 102, 204, 0.2);
    direction: rtl;
}

#closeChatbotButton {
    background: none;
    border: none;
    color: var(--text-color);
    font-size: 20px;
    cursor: pointer;
}

#chatMessages {
    flex-grow: 1;
    padding: 15px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    direction: rtl;
    /* Enhanced smooth scrolling for chat */
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: var(--accent-blue) rgba(0,0,0,0.3);
}

#chatMessages::-webkit-scrollbar {
    width: 6px;
}

#chatMessages::-webkit-scrollbar-track {
    background: rgba(0,0,0,0.3);
    border-radius: 3px;
}

#chatMessages::-webkit-scrollbar-thumb {
    background: var(--accent-blue);
    border-radius: 3px;
    transition: background 0.3s ease;
}

#chatMessages::-webkit-scrollbar-thumb:hover {
    background: var(--primary-blue);
}

.chat-message {
    max-width: 85%;
    padding: 10px 15px;
    border-radius: 10px;
    margin-bottom: 10px;
    font-size: 0.95rem;
    line-height: 1.5;
    word-wrap: break-word;
    direction: rtl;
    text-align: right;
}

.user-message {
    background-color: var(--user-msg-bg);
    color: white;
    margin-right: auto; 
    border-bottom-left-radius: 0;
}

.bot-message {
    background-color: var(--bot-msg-bg);
    color: var(--text-color);
    margin-left: auto; 
    border-bottom-right-radius: 0;
}

.typing-indicator span {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--accent-blue);
    margin: 0 2px;
    animation: typing-bounce 1s infinite ease-in-out;
}

.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing-bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-4px); }
}

#chatbotInputArea {
    display: flex;
    padding: 15px;
    border-top: 1px solid rgba(0, 102, 204, 0.2);
    direction: rtl;
}

#chatInput {
    flex-grow: 1;
    background-color: var(--chat-input-bg);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 10px 15px;
    color: var(--text-color);
    font-size: 0.9rem;
    margin-left: 10px; /* Space between input and send button in RTL */
    text-align: right;
    direction: rtl;
}

#chatInput:focus {
    outline: none;
    border-color: var(--accent-blue);
}

#sendChatMsg {
    background-color: var(--primary-blue);
    color: white;
    border: none;
    border-radius: 20px;
    padding: 10px 15px;
    cursor: pointer;
    font-weight: 500;
    transition: background-color 0.2s;
}

#sendChatMsg:hover {
    background-color: var(--accent-blue);
}

#sendChatMsg:disabled {
    background-color: #555;
    cursor: not-allowed;
}

#chatLimitMessage {
    background-color: rgba(255, 215, 0, 0.1); 
    color: #ffd700;
    padding: 10px;
    font-size: 0.85rem;
    text-align: center;
    direction: rtl;
}

#chatLimitMessage a {
    color: var(--accent-blue);
    text-decoration: underline;
}

/* תיקוני רספונסיביות */
@media (max-width: 1200px) {
    .container {
        max-width: 95%;
        padding: 0 15px;
    }
    
    .feature-slide {
        flex-direction: column;
        gap: 30px;
    }
    
    .feature-slide > div {
        width: 100%;
        margin: 0;
        padding: 0;
    }
    
    .demo-window {
        margin: 20px auto;
        max-width: 600px;
        overflow: visible;
    }
}

@media (max-width: 768px) {
    /* CRITICAL: Complete mobile optimization */
    html, body {
        overflow-x: hidden !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important;
        scroll-behavior: smooth !important;
        min-height: 100vh !important;
        touch-action: pan-y !important;
        -webkit-text-size-adjust: 100% !important;
        -ms-text-size-adjust: 100% !important;
        position: relative !important;
        width: 100% !important;
    }
    
    /* CRITICAL: Keep stars visible and ensure proper display */
    .parallax-bg {
        display: block !important;
        opacity: 1 !important;
        visibility: visible !important;
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        width: 100% !important;
        height: 100vh !important;
        pointer-events: none !important;
        z-index: -2 !important;
        overflow: hidden !important;
    }
    
    .parallax-star {
        display: block !important;
        opacity: 1 !important;
        visibility: visible !important;
        animation: twinkle 2s infinite ease-in-out !important;
        position: absolute !important;
        background: #ffffff !important;
        border-radius: 50% !important;
        pointer-events: none !important;
        box-shadow: 0 0 6px rgba(255, 255, 255, 0.8) !important;
    }
    
    /* Disable shooting stars for performance */
    .shooting-star {
        display: none !important;
    }
    
    /* Keep gradient background but reduce intensity */
    .gradient-bg {
        display: block !important;
        opacity: 0.2 !important;
        animation: none !important;
    }
    
    /* Body background for mobile with stars support */
    body {
        background: linear-gradient(180deg, #050505 0%, #030303 100%) !important;
    }
    
    /* CRITICAL: Hide navigation header text "סביבת לימוד תורה" ONLY on mobile */
    header .gradient-text {
        display: none !important;
        visibility: hidden !important;
        opacity: 0 !important;
    }
    
    /* Hide the entire header text link on mobile */
    header a[href="#"] {
        display: none !important;
    }
    
    /* Keep subtitle visible on mobile but optimize it */
    #subtitle {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
        font-size: 1.1rem !important;
        line-height: 1.5 !important;
        padding: 0 1rem !important;
        text-shadow: 1px 1px 4px rgba(0,0,0,0.8) !important;
        margin-bottom: 2rem !important;
    }
    
    /* Critical mobile title fix - maintain beauty AND gradient */
    #main-title {
        font-size: 3.2rem !important;
        line-height: 1.1 !important;
        margin-bottom: 2rem !important;
        /* Enhanced text shadow for mobile */
        text-shadow: 
            0 0 10px rgba(0, 163, 255, 0.3),
            2px 2px 8px rgba(0, 0, 0, 0.8),
            4px 4px 16px rgba(0, 0, 0, 0.6) !important;
        font-weight: 900 !important;
        letter-spacing: 0.5px !important;
        /* CRITICAL: Keep Hebrew text together while maintaining spacing */
        white-space: nowrap !important;
        word-break: keep-all !important;
        hyphens: none !important;
        overflow: visible !important;
        text-overflow: clip !important;
        /* Better text rendering */
        text-rendering: optimizeLegibility !important;
        -webkit-font-smoothing: antialiased !important;
        -moz-osx-font-smoothing: grayscale !important;
        /* Perfect centering with LTR container for RTL content */
        text-align: center !important;
        width: 100% !important;
        padding: 0 0.5rem !important;
        /* Enhanced mobile gradient preservation */
        background: none !important;
        direction: ltr !important;
        unicode-bidi: embed !important;
    }
    
    /* Make title extra large on mobile */
    #main-title {
        font-size: 4rem !important; /* 64px */
        line-height: 1.1 !important;
        margin-bottom: 2rem !important;
        white-space: nowrap !important;
        word-break: keep-all !important;
        hyphens: none !important;
        overflow: visible !important;
        text-overflow: clip !important;
        width: 100% !important;
        text-align: center !important;
        direction: ltr !important;
        unicode-bidi: embed !important;
    }
    
    /* PRESERVE simple blue text on mobile */
    #main-title .gradient-text {
        color: #00a3ff !important;
        background: none !important;
        -webkit-background-clip: initial !important;
        background-clip: initial !important;
        display: inline !important;
        white-space: nowrap !important;
        margin: 0 0.1rem !important;
        filter: none !important;
        direction: rtl !important;
        unicode-bidi: embed !important;
    }
    
    /* PRESERVE white text styling for mobile */
    #main-title .text-white {
        color: #ffffff !important;
        background: none !important;
        -webkit-background-clip: initial !important;
        background-clip: initial !important;
        color: #ffffff !important;
        display: inline !important;
        white-space: nowrap !important;
        margin: 0 0.1rem !important;
        filter: none !important;
        text-shadow: none !important;
        direction: rtl !important;
        unicode-bidi: embed !important;
    }
    
    /* Container adjustments */
    .container.mx-auto.max-w-5xl {
        padding: 0 0.5rem !important;
        overflow: visible !important;
        width: 100% !important;
        max-width: 100% !important;
    }
    
    /* Hero section */
    section.relative.min-h-screen {
        padding: 80px 0.5rem 60px !important;
        min-height: auto !important;
    }
    
    /* Remove "סביבת לימוד תורה" subtitle on mobile only */
    #subtitle {
        display: none !important;
    }

    /* Search container mobile optimization */
    #search-container {
        padding: 0 1rem !important;
        margin-bottom: 2rem !important;
        position: relative !important;
    }
    
    /* Search box mobile-friendly with proper icon positioning */
    .search-box {
        padding: 16px 50px 16px 24px !important; /* Add space for icon on the right */
        font-size: 16px !important; /* Prevent zoom on iOS */
        border: 2px solid rgba(0, 102, 204, 0.5) !important;
        border-radius: 25px !important;
        background: rgba(0, 0, 0, 0.85) !important;
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
        min-height: 48px !important; /* Better touch target */
        box-sizing: border-box !important;
        text-align: right !important;
        direction: rtl !important;
        width: 100% !important;
    }
    
    .search-box:focus {
        border-color: var(--accent-blue) !important;
        box-shadow: 0 0 12px rgba(0, 163, 255, 0.4) !important;
        outline: none !important;
    }
    
    /* Hide search button on mobile */
    form[role="search"] button[type="submit"] {
        display: none !important;
    }
    
    /* CRITICAL: Hide chat toggle button on mobile ONLY */
    #chatbotToggleButton {
        display: none !important;
        visibility: hidden !important;
        opacity: 0 !important;
        pointer-events: none !important;
    }
    
    /* Remove ALL backdrop filters for performance */
    .demo-window,
    .feature-card,
    header,
    #chatbotContainer {
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
    }
    
    /* Optimize demo windows */
    .demo-window {
        margin-bottom: 25px !important;
        box-shadow: 0 6px 20px rgba(0,0,0,0.4) !important;
        background: rgba(0, 0, 0, 0.9) !important;
        border: 1px solid rgba(0, 102, 204, 0.4) !important;
    }
    
    .window-content {
        height: 250px !important;
        padding: 16px !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important;
        /* Better touch scrolling area */
        scroll-padding: 10px !important;
    }
    
    /* Feature cards mobile optimization */
    .feature-card {
        margin-bottom: 20px !important;
        padding: 24px !important;
        background: rgba(0, 0, 0, 0.85) !important;
        border: 1px solid rgba(0, 102, 204, 0.3) !important;
        box-shadow: 0 4px 15px rgba(0,0,0,0.3) !important;
    }
    
    .feature-card:hover {
        transform: translateY(-3px) !important;
        box-shadow: 0 8px 25px rgba(0, 163, 255, 0.15) !important;
    }
    
    /* Button optimization */
    .glowing-button {
        padding: 14px 28px !important;
        font-size: 16px !important;
        min-height: 48px !important; /* Better touch target */
        box-shadow: 0 4px 15px rgba(0, 102, 204, 0.4) !important;
        border-radius: 25px !important;
    }
    
    .glowing-button:hover {
        box-shadow: 0 6px 20px rgba(0, 163, 255, 0.5) !important;
    }
    
    /* Disable complex button animations */
    .glowing-button:after {
        display: none !important;
    }
    
    /* Typography mobile optimization */
    h1 { font-size: 2.8rem !important; }
    h2 { font-size: 2rem !important; }
    h3 { font-size: 1.5rem !important; }
    
    /* Grid simplification */
    .grid {
        grid-template-columns: 1fr !important;
        gap: 20px !important;
    }
    
    /* Navigation optimization */
    header {
        background: rgba(0, 0, 0, 0.95) !important;
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
    }
    
    /* Mobile menu improvements */
    #mobile-menu {
        background: rgba(0, 0, 0, 0.98) !important;
        padding: 20px !important;
        border-top: 1px solid rgba(0, 102, 204, 0.3) !important;
    }
    
    /* Chatbot mobile optimization */
    #chatbotContainer {
        width: 95vw !important;
        max-width: 380px !important;
        right: 2.5vw !important;
        left: auto !important;
        height: 400px !important;
        background: rgba(0, 0, 0, 0.95) !important;
        border: 1px solid rgba(0, 102, 204, 0.4) !important;
        box-shadow: 0 8px 25px rgba(0,0,0,0.6) !important;
    }
    
    #chatbotToggleButton {
        right: 20px !important;
        left: auto !important;
        bottom: 20px !important;
        width: 56px !important;
        height: 56px !important;
        font-size: 22px !important;
        box-shadow: 0 4px 15px rgba(0, 102, 204, 0.5) !important;
        /* Enhanced mobile positioning - ensure it stays fixed */
        position: fixed !important;
        z-index: 9999 !important;
        -webkit-transform: translateZ(0) !important;
        transform: translateZ(0) !important;
        will-change: transform !important;
        background-color: var(--primary-blue) !important;
        border: none !important;
        border-radius: 50% !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }
    
    /* Chat messages optimization */
    #chatMessages {
        -webkit-overflow-scrolling: touch !important;
        scroll-behavior: smooth !important;
        padding: 16px !important;
    }
    
    .chat-message {
        padding: 12px 16px !important;
        font-size: 15px !important;
        margin-bottom: 12px !important;
        border-radius: 12px !important;
        max-width: 90% !important;
    }
    
    /* Chat input optimization */
    #chatInput {
        font-size: 16px !important; /* Prevent zoom on iOS */
        padding: 12px 16px !important;
        min-height: 44px !important; /* Better touch target */
        border-radius: 22px !important;
    }
    
    #sendChatMsg {
        min-width: 44px !important;
        min-height: 44px !important;
        padding: 12px !important;
        border-radius: 22px !important;
    }
    
    /* Section spacing optimization */
    section {
        padding: 50px 0 !important;
    }
    
    /* IMPROVED: כלים נוספים section mobile layout fixes */
    #additional-tools .feature-slide {
        flex-direction: column !important;
        text-align: center !important;
        gap: 20px !important;
        margin-bottom: 30px !important;
    }
    
    /* Fix the order - text/button content should come first, then demo window */
    #additional-tools .feature-slide {
        display: flex !important;
        flex-direction: column !important;
    }
    
    /* Ensure text content comes first on mobile */
    #additional-tools .feature-slide > div:last-child {
        order: 1 !important;
        width: 100% !important;
        margin: 0 0 20px 0 !important;
        padding: 0 !important;
        text-align: center !important;
    }
    
    /* Demo window comes second on mobile */
    #additional-tools .feature-slide > div:first-child {
        order: 2 !important;
        width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
    }
    
    /* Improve text readability and button positioning */
    #additional-tools .text-center h3 {
        font-size: 1.5rem !important;
        margin-bottom: 1rem !important;
        text-align: center !important;
    }
    
    #additional-tools .text-center p {
        font-size: 0.95rem !important;
        line-height: 1.4 !important;
        margin-bottom: 1.5rem !important;
        text-align: center !important;
        padding: 0 0.5rem !important;
    }
    
    /* Button improvements for mobile */
    #additional-tools .glowing-button {
        display: inline-block !important;
        margin: 0 auto 1rem auto !important;
        font-size: 15px !important;
        padding: 12px 20px !important;
        text-align: center !important;
    }
    
    /* Info text improvements */
    #additional-tools .text-xs {
        font-size: 0.8rem !important;
        text-align: center !important;
        margin-top: 0.5rem !important;
        padding: 0 0.5rem !important;
    }
    
    /* Demo window mobile optimization */
    #additional-tools .demo-window {
        margin: 0 auto !important;
        max-width: 100% !important;
        height: auto !important;
    }
    
    #additional-tools .window-content {
        height: 200px !important;
        padding: 12px !important;
        font-size: 0.85rem !important;
    }
    
    /* Feature lists mobile optimization */
    #additional-tools ul {
        text-align: center !important;
        padding: 0 !important;
        margin: 0 0 1.5rem 0 !important;
    }
    
    #additional-tools ul li {
        text-align: center !important;
        font-size: 0.9rem !important;
        margin-bottom: 0.5rem !important;
        padding: 0 0.5rem !important;
    }
    
    /* Disable all complex animations */
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-delay: -0.01ms !important;
        animation-iteration-count: 1 !important;
        background-attachment: initial !important;
        transition: opacity 0.2s ease, transform 0.2s ease !important;
    }
    
    /* Performance optimizations: only promote elements that actually animate */
    .glowing-button,
    .feature-card,
    .demo-window,
    #chatbotContainer,
    #chatbotToggleButton {
        will-change: transform;
    }
    
    /* Scroll optimization */
    html {
        scroll-behavior: smooth !important;
        scroll-padding-top: 80px !important;
    }
    
    /* Better touch targets for buttons and links only */
    button {
        min-height: 44px;
        min-width: 44px;
    }
    
    /* Text input specific optimizations */
    input[type="text"], textarea {
        -webkit-appearance: none;
        appearance: none;
    }
}

@media (max-width: 480px) {
    /* Ultra-mobile optimization - maintain beauty at smaller size */
    #main-title {
        font-size: 2.6rem !important;
        line-height: 1.05 !important;
        margin-bottom: 1.5rem !important;
        /* Enhanced text shadow for smaller screens */
        text-shadow: 
            0 0 8px rgba(0, 163, 255, 0.4),
            2px 2px 6px rgba(0, 0, 0, 0.9),
            3px 3px 12px rgba(0, 0, 0, 0.7) !important;
        letter-spacing: 0.3px !important;
        /* CRITICAL: Ensure Hebrew text stays on one line */
        white-space: nowrap !important;
        word-break: keep-all !important;
        hyphens: none !important;
        overflow: visible !important;
        padding: 0 0.25rem !important;
        width: 100% !important;
        max-width: 100% !important;
    }
    
    /* Preserve gradients on small screens */
    #main-title .gradient-text {
        color: #00a3ff !important;
        background: none !important;
        -webkit-background-clip: initial !important;
        background-clip: initial !important;
        filter: none !important;
    }
    
    #main-title .text-white {
        color: #ffffff !important;
        filter: none !important;
        text-shadow: none !important;
    }
    
    /* Make sure spans don't break */
    #main-title span {
        display: inline !important;
        white-space: nowrap !important;
        margin: 0 !important;
    }
    
    /* Container ultra-mobile */
    .container.mx-auto.max-w-5xl {
        padding: 0 0.25rem !important;
        overflow: visible !important;
        width: 100% !important;
        max-width: 100% !important;
    }
    
    /* Subtitle ultra-mobile */
    #subtitle {
        font-size: 0.95rem !important;
        line-height: 1.3 !important;
        margin-bottom: 1.5rem !important;
        padding: 0 0.5rem !important;
    }
    
    /* Search container ultra-mobile */
    #search-container {
        padding: 0 0.5rem !important;
        margin-bottom: 1.5rem !important;
    }
    
    /* Search box ultra-mobile friendly */
    .search-box {
        padding: 14px 20px !important;
        font-size: 16px !important;
        border: 1px solid rgba(0, 102, 204, 0.6) !important;
        background: rgba(0, 0, 0, 0.9) !important;
        min-height: 48px !important;
    }
    
    /* Typography ultra-mobile */
    h1 { font-size: 2.2rem !important; }
    h2 { font-size: 1.6rem !important; }
    h3 { font-size: 1.3rem !important; }
    
    /* Window content ultra-mobile */
    .window-content {
        height: 200px !important;
        padding: 12px !important;
        font-size: 0.9rem !important;
    }
    
    /* Feature cards ultra-mobile */
    .feature-card {
        padding: 18px !important;
        margin-bottom: 15px !important;
        border: 1px solid rgba(0, 102, 204, 0.25) !important;
        background: rgba(0, 0, 0, 0.9) !important;
    }
    
    .feature-card:hover {
        transform: translateY(-2px) !important;
        box-shadow: 0 4px 12px rgba(0, 163, 255, 0.12) !important;
    }
    
    /* Chatbot ultra-mobile */
    #chatbotContainer {
        width: 96vw !important;
        right: 2vw !important;
        left: auto !important;
        height: 380px !important;
        max-width: none !important;
    }
    
    #chatbotToggleButton {
        right: 15px !important;
        left: auto !important;
        bottom: 15px !important;
        width: 52px !important;
        height: 52px !important;
        font-size: 20px !important;
    }
    
    /* Button ultra-mobile */
    .glowing-button {
        padding: 12px 24px !important;
        font-size: 15px !important;
        min-height: 48px !important;
    }
    
    /* Text sizing ultra-mobile */
    .text-lg {
        font-size: 0.95rem !important;
    }
    
    .text-xl {
        font-size: 1.1rem !important;
    }
    
    /* Chat messages ultra-mobile */
    .chat-message {
        padding: 10px 14px !important;
        font-size: 14px !important;
        margin-bottom: 10px !important;
        max-width: 92% !important;
    }
    
    /* Chat input ultra-mobile */
    #chatInput {
        font-size: 16px !important;
        padding: 10px 14px !important;
        min-height: 42px !important;
    }
    
    #sendChatMsg {
        min-width: 42px !important;
        min-height: 42px !important;
        padding: 10px !important;
    }
    
    /* Section spacing ultra-mobile */
    section {
        padding: 40px 0 !important;
    }
    
    /* Hero section ultra-mobile */
    section.relative.min-h-screen {
        padding: 70px 0.25rem 50px !important;
    }
    
    /* Feature slide ultra-mobile */
    .feature-slide {
        gap: 25px !important;
        margin-bottom: 30px !important;
    }
    
    /* Demo window ultra-mobile */
    .demo-window {
        margin: 12px 0 !important;
        box-shadow: 0 3px 12px rgba(0,0,0,0.4) !important;
    }
    
    /* All performance optimizations remain */
    * {
        animation: none !important;
        transition: opacity 0.15s ease, transform 0.15s ease !important;
    }
    
    /* Better touch targets remain */
    a, button, input, select, textarea {
        min-height: 44px !important;
        min-width: 44px !important;
    }
}

/* תיקוני תצוגה נוספים */
.flex {
    flex-direction: row-reverse !important;
}

.flex-col {
    flex-direction: column !important;
}

.md\\:flex-row {
    flex-direction: row-reverse !important;
}

/* תיקוני margins ו-paddings לעברית */
.ml-2 { margin-left: 0 !important; margin-right: 8px !important; }
.mr-2 { margin-right: 0 !important; margin-left: 8px !important; }
.ml-4 { margin-left: 0 !important; margin-right: 16px !important; }
.mr-4 { margin-right: 0 !important; margin-left: 16px !important; }
.pl-10 { padding-left: 0 !important; padding-right: 40px !important; }
.pr-10 { padding-right: 0 !important; padding-left: 40px !important; }
.md\\:pl-10 { padding-left: 0 !important; padding-right: 40px !important; }
.md\\:pr-10 { padding-right: 0 !important; padding-left: 40px !important; }

/* תיקוני navigation */
nav {
    direction: rtl !important;
}

nav a {
    text-align: center;
    padding: 8px 16px;
    margin: 0 4px;
}

/* עיצוב הניווט המרכזי */
header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}

header nav {
    justify-content: center !important;
    text-align: center !important;
}

header nav a {
    text-align: center !important;
}

/* רשימות */
ul, ol {
    padding-right: 20px;
    padding-left: 0;
    text-align: right !important;
    direction: rtl !important;
}

ul li, ol li {
    text-align: right !important;
    direction: rtl !important;
    list-style-position: inside;
}

/* Accessibility וניקוי אחרון */
html {
    scroll-behavior: smooth;
    overflow-x: hidden;
    overflow-y: auto;
    height: 100%;
    /* Enhanced scroll padding for better navigation experience */
    scroll-padding-top: 100px;
}

body {
    overflow-x: hidden;
    overflow-y: auto;
    position: relative;
    /* Enhanced momentum scrolling */
    -webkit-overflow-scrolling: touch;
}

/* Enhanced smooth scroll behavior for anchor links */
a[href^="#"] {
    scroll-behavior: smooth;
}

/* Smooth transitions for all interactive elements */
*, *::before, *::after {
    transition-property: transform, opacity, background-color, border-color, color, box-shadow;
    transition-duration: 0.3s;
    transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
    will-change: auto;
}

/* Performance optimization for animations */
.parallax-star, .shooting-star, .gradient-bg {
    will-change: transform, opacity;
    transform: translateZ(0);
    backface-visibility: hidden;
}

/* Better GPU acceleration for smooth animations */
.feature-slide, .demo-window, .feature-card {
    will-change: transform;
    transform: translateZ(0);
}

/* Enhanced scrolling performance */
section {
    scroll-margin-top: 80px;
    transform: translateZ(0);
}

/* CRITICAL: Help section should load instantly - no delays */
#download .feature-card,
#help .feature-card,
.help-section .feature-card,
[id*="help"] .feature-card {
    opacity: 1 !important;
    visibility: visible !important;
    transform: translateY(0) scale(1) !important;
    animation: none !important;
    transition: all 0.3s ease !important;
}

#download .glowing-button,
#help .glowing-button,
.help-section .glowing-button,
[id*="help"] .glowing-button {
    opacity: 1 !important;
    visibility: visible !important;
    transform: translateY(0) scale(1) !important;
    animation: none !important;
    transition: all 0.3s ease !important;
}

/* Ensure help section content loads immediately */
#download div[class*="grid"],
#help div[class*="grid"],
.help-section div[class*="grid"] {
    opacity: 1 !important;
    visibility: visible !important;
}

/* Override any GSAP delays for help section */
#download h2,
#download h3,
#download p,
#help h2,
#help h3,
#help p {
    opacity: 1 !important;
    visibility: visible !important;
    transform: translateY(0) !important;
}

/* תיקון לוודא שכל הסקציות נגישות לגלילה */
section {
    position: relative;
    z-index: 1;
    clear: both;
    width: 100%;
    overflow: visible;
}

/* תיקון למניעת overflow בקונטיינרים */
.container {
    overflow: visible;
    position: relative;
}

a:focus, button:focus {
    outline: 2px solid var(--accent-blue);
    outline-offset: 2px;
}

/* תיקוני עיצוב נוספים */
h1, h2, h3, h4, h5, h6 {
    line-height: 1.2;
    margin-bottom: 1rem;
}

.leading-relaxed {
    line-height: 1.8;
}

.border-r-4 {
    border-right-width: 4px;
}

.particle { 
    position: absolute;
    border-radius: 50%;
    background: rgba(0, 163, 255, 0.5);
    pointer-events: none;
}

/* שיפור לניווט */
header {
    backdrop-filter: blur(15px);
    border-bottom: 1px solid rgba(0, 102, 204, 0.1);
}

/* שיפור ל-Footer */
footer {
    backdrop-filter: blur(10px);
    border-top: 1px solid rgba(0, 102, 204, 0.1);
}

/* תיקוני עיצוב נוספים */
h1, h2, h3, h4, h5, h6 {
    line-height: 1.2;
    margin-bottom: 1rem;
}

.leading-relaxed {
    line-height: 1.8;
}

.border-r-4 {
    border-right-width: 4px;
}

.particle { 
    position: absolute;
    border-radius: 50%;
    background: rgba(0, 163, 255, 0.5);
    pointer-events: none;
}

/* Mobile fix: "איך זה עובד" - icon circles overlapping text on mobile */
@media (max-width: 768px) {
    #how-it-works ol {
        margin-right: 1.5rem !important;
        padding-right: 2rem !important;
    }

    #how-it-works ol li > div {
        /* Tailwind ring-8 = 8px ring; replace with 4px so icon doesn't overlap text */
        box-shadow: 0 0 0 4px var(--dark-bg) !important;
        right: -2.75rem !important; /* Move the dot further right past the border */
    }
}
