﻿@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@400;700;900&family=Tajawal:wght@400;700&display=swap');

body {
    margin: 0;
    background-color: #05080f;
    font-family: 'Montserrat', sans-serif;
    color: white;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

#particleCanvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
}

.main-layout {
    display: flex;
    flex-direction: column;
    align-items: center;
    z-index: 1;
}

.header-title {
    font-size: 3.5rem;
    font-weight: 900;
    letter-spacing: 8px;
    margin-bottom: 50px;
    color: #fff;
    text-shadow: 0 0 20px rgba(0, 240, 255, 0.6);
}

.puzzle-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 30px; /* Space between the massive cubes */
    width: 90vw; /* Takes up most of the screen width */
    max-width: 1200px;
    justify-items: center;
}

/* Bigger, Rectangular Cubes with Aura */
.puzzle-piece {
    /* Calculated to take up roughly half the vertical space available */
    width: 100%;
    max-width: 500px;
    height: 35vh;
    background: rgba(15, 23, 42, 0.7);
    backdrop-filter: blur(10px);
    border: 3px solid rgba(0, 240, 255, 0.2);
    border-radius: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    /* Smooth transitions for the aura and scale */
    transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

    .puzzle-piece span {
        font-size: 2.5rem; /* Larger text for larger cubes */
        font-weight: 900;
        letter-spacing: 5px;
        z-index: 2;
        pointer-events: none;
    }

    /* The Intense Aura Glow */
    .puzzle-piece::after {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: radial-gradient(circle, rgba(0, 240, 255, 0.15) 0%, transparent 70%);
        opacity: 0;
        transition: opacity 0.4s;
    }

    .puzzle-piece:hover {
        transform: scale(1.03);
        border-color: #00f0ff;
        box-shadow: 0 0 50px rgba(0, 240, 255, 0.3);
    }

        .puzzle-piece:hover::after {
            opacity: 1;
        }
/* Welcome Screen Styling */
.welcome-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #05080f;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    cursor: pointer;
    transition: opacity 0.8s ease, visibility 0.8s ease;
}

.welcome-content {
    text-align: center;
}

    .welcome-content h1 {
        font-size: 5rem;
        font-weight: 900;
        letter-spacing: 15px;
        margin-bottom: 10px;
        color: #fff;
        text-shadow: 0 0 20px rgba(0, 240, 255, 0.6);
    }

    .welcome-content p {
        font-size: 1.2rem;
        letter-spacing: 5px;
        color: #64748b;
        margin-bottom: 40px;
    }

.start-hint {
    font-size: 0.9rem;
    color: #00f0ff;
    letter-spacing: 2px;
    animation: pulseGlow 2s infinite;
}

@keyframes pulseGlow {
    0%, 100% {
        opacity: 0.3;
        text-shadow: 0 0 0px #00f0ff;
    }

    50% {
        opacity: 1;
        text-shadow: 0 0 15px #00f0ff;
    }
}

/* Class to hide the welcome screen */
.welcome-hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

/* Adjustments for the blast animation to handle larger sizes */
@keyframes blastOut {
    0% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }

    100% {
        transform: scale(8) rotate(30deg);
        opacity: 0;
        filter: blur(30px);
    }
}
/* Modal Overlay */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(5, 8, 15, 0.9);
    display: none; /* Controlled by JS */
    justify-content: center;
    align-items: center;
    z-index: 100;
    backdrop-filter: blur(12px);
}

.modal-content {
    background: #0f172a;
    padding: 60px;
    border-radius: 20px;
    width: 85%;
    max-width: 1000px;
    height: 85vh;
    border: 1px solid #00f0ff;
    box-shadow: 0 0 60px rgba(0, 240, 255, 0.2);
    position: relative;
    /* The starting state for the pop-up */
    transform: scale(0);
    opacity: 0;
    /* Fast but smooth elastic transition */
    transition: transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.4s ease;
}

/* When the overlay is active, the content grows to full size */
.modal-overlay.active .modal-content {
    transform: scale(1);
    opacity: 1;
}

.close-btn {
    position: absolute;
    top: 20px;
    right: 30px;
    background: none;
    border: none;
    color: white;
    font-size: 2.5rem;
    cursor: pointer;
}

.text-content {
    height: 100%;
    overflow-y: auto;
    padding-right: 20px;
}

#modalTitle {
    font-size: 2.8rem;
    color: #00f0ff;
    margin-bottom: 30px;
    border-left: 5px solid #00f0ff;
    padding-left: 20px;
}

#modalBody {
    font-size: 1.3rem;
    line-height: 2;
    color: #e2e8f0;
}

.detail-section {
    margin-bottom: 25px;
}

.detail-title {
    font-weight: 900;
    color: #00f0ff;
    display: block;
    margin-bottom: 5px;
}

.translate-btn {
    background: #00f0ff;
    color: #050810;
    border: none;
    padding: 15px 40px;
    border-radius: 8px;
    font-weight: 900;
    cursor: pointer;
    box-shadow: 0 0 15px rgba(0, 240, 255, 0.5);
    transition: 0.3s;
}

    .translate-btn:hover {
        transform: translateY(-3px);
        box-shadow: 0 0 25px #00f0ff;
    }

.fade-text {
    transition: opacity 0.3s;
}

.fade-out {
    opacity: 0;
}

.arabic-text {
    direction: rtl;
    font-family: 'Tajawal';
}
/* Animation to blast elements out of the screen */
/* Scatter Animation - Each piece goes its own way */
.scatter-1 {
    animation: scatterTopLeft 1.2s forwards cubic-bezier(0.2, 0.8, 0.2, 1);
}

.scatter-2 {
    animation: scatterTopRight 1.2s forwards cubic-bezier(0.2, 0.8, 0.2, 1);
}

.scatter-3 {
    animation: scatterBottomLeft 1.2s forwards cubic-bezier(0.2, 0.8, 0.2, 1);
}

.scatter-4 {
    animation: scatterBottomRight 1.2s forwards cubic-bezier(0.2, 0.8, 0.2, 1);
}

@keyframes scatterTopLeft {
    to {
        transform: translate(-100vw, -100vh) rotate(-45deg);
        opacity: 0;
    }
}

@keyframes scatterTopRight {
    to {
        transform: translate(100vw, -100vh) rotate(45deg);
        opacity: 0;
    }
}

@keyframes scatterBottomLeft {
    to {
        transform: translate(-100vw, 100vh) rotate(-45deg);
        opacity: 0;
    }
}

@keyframes scatterBottomRight {
    to {
        transform: translate(100vw, 100vh) rotate(45deg);
        opacity: 0;
    }
}
.credit-link {
    text-decoration: none;
    color: inherit;
    display: block;
    transition: transform 0.3s ease, filter 0.3s ease;
    cursor: pointer;
}

    .credit-link:hover {
        transform: scale(1.5);
        filter: brightness(1);
        text-shadow: 0 0 10px rgb(255, 195, 0, 0.80), 0 0 20px rgb(255, 0, 0), 0 0 40px rgb(255, 0, 0, 1.00);
    }


.dev-tag {
    position: fixed;
    top: 10px;
    right: 10px;
    font-size: 0.7rem;
    color: rgba(0, 240, 255, 0.5);
    z-index: 9999;
    font-family: 'Montserrat', sans-serif;
    pointer-events: none;
}
.end-button {
    position: fixed;
    bottom: 10px;
    left: 50px;
    background: transparent;
    color: #00f0ff;
    border: 1px solid #00f0ff;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-family: 'Montserrat', sans-serif;
    z-index: 100;
    transition: 0.3s;
}

    .end-button:hover {
        background: #00f0ff;
        color: #05080f;
    }

/* --- MOBILE RESPONSIVENESS (The Phone "Shape") --- */
@media (max-width: 768px) {
    .credits-content h1 {
        font-size: 1.2rem !important; /* تقليل حجم الخط ليناسب شاشة الهاتف */
        margin-bottom: 20px !important;
    }

    .credits-content h2 {
        font-size: 0.8rem !important; /* تقليل حجم العناوين الفرعية */
        margin-bottom: 5px !important;
    }
    .credits-content {
        padding-bottom: 50px;
    }
    .end-button {
        bottom: 10px;
        left: 20px;
        padding: 8px 15px;
        font-size: 0.7rem;
    }
    body {
        overflow-x: hidden; /* Prevent horizontal scrolling */
        width: 100vw;
    }
    .header-title {
        font-size: 1.5rem;
    }

    .puzzle-grid {
        display: grid;
        /* Use 1fr to ensure they only take up the available width */
        grid-template-columns: 1fr;
        gap: 15px;
        /* Use viewport width with a safe margin */
        width: 90vw;
        max-width: 500px; /* Limits size on desktop */
        margin: 0 auto;
        justify-items: center;
    }

    .puzzle-piece {
        /* Use relative units so they scale with screen height */
        width: 100%;
        height: 18vh;
        background: rgba(15, 23, 42, 0.7);
        border: 2px solid rgba(0, 240, 255, 0.2);
        border-radius: 15px;
        display: flex;
        justify-content: center;
        align-items: center;
        cursor: pointer;
        position: relative;
        overflow: hidden;
        transition: transform 0.3s ease;
    }
        .puzzle-piece span {
            font-size: 1.5rem; /* Smaller font for better fit */
            font-weight: 700;
        }

    .modal-content {
        box-sizing: border-box;
    }

    #modalTitle {
        font-size: 1rem;
    }

    #modalBody {
        font-size: 1.1rem;
        line-height: 1.6;
    }

    .credits-content h1 {
        font-size: 1.5rem; /* Smaller text for credits on phones */
    }

    .credits-content h2 {
        font-size: 1rem;
    }
    .welcome-content {
        text-align: center;
    }

        .welcome-content h1 {
            font-size: 2rem;
            font-weight: 900;
            letter-spacing: 8px;
            margin-bottom: 10px;
            color: #fff;
            text-shadow: 0 0 20px rgba(0, 240, 255, 0.6);
        }

        .welcome-content p {
            font-size: 1rem;
            letter-spacing: 3px;
            color: #64748b;
            margin-bottom: 40px;
        }
    .credit-link {
        text-decoration: none;
        color: inherit;
        display: block;
        transition: transform 0.3s ease, filter 0.3s ease;
        cursor: pointer;
    }
        

        .credit-link:hover {
            transform: scale(0.6);
            filter: brightness(1);
            text-shadow: 0 0 10px rgb(255, 195, 0, 0.80), 0 0 20px rgb(255, 0, 0), 0 0 40px rgb(255, 0, 0, 1.00);
        }
}

/* Special fix for very small screens */
@media (max-height: 600px) {
    .modal-content {
        height: 95vh;
        padding: 20px;
    }

    .translate-btn {
        padding: 10px 20px;
    }
}
/* Credits Popup Styling */
.credits-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: transparent;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 500;
    visibility: hidden;
}

.credits-content {
    text-align: center;
    opacity: 0;
    transform: translateY(50px);
    transition: all 1.5s ease;
}

.credits-overlay.active .credits-content {
    opacity: 1;
    transform: translateY(0);
}

.credits-content h2 {
    font-size: 1.5rem;
    color: #00f0ff;
    letter-spacing: 5px;
    margin-bottom: 10px;
    font-weight: 400;
}

.credits-content h1 {
    font-size: 3rem;
    font-weight: 900;
    margin-bottom: 40px;
    text-shadow: 0 0 30px rgba(0, 240, 255, 0.8);
}