:root {
    --primary-color: #f44336; /* Example Red */
    --secondary-color: #ff9800; /* Example Orange */
    --light-color: #ffffff;
    --dark-color: #333333;
    --font-family: 'Arial', sans-serif;
}

body {
    margin: 0;
    font-family: var(--font-family);
    line-height: 1.6;
    background-color: var(--light-color);
    color: var(--dark-color);
    min-width: 320px; /* Base mobile width */
    overflow-x: hidden; /* Prevent horizontal scroll */
}

/* Class added when game is active to prevent scrolling */
body.game-active {
    overflow: hidden;
}

header {
    padding: 1rem;
    width: 100%;
    box-sizing: border-box;
    position: absolute; /* Position over hero */
    top: 0;
    left: 0;
    z-index: 5; /* Below game container (10), above hero bg */
    background-color: transparent; /* Let hero background show through */
}

#logo {
    max-width: 100%; /* Allow logo to fill header width on mobile */
    height: auto;
    display: block; /* Remove extra space below image */
    margin: 0 auto; /* Center if header has padding but logo is smaller */
}

.hidden {
    display: none !important; /* Utility class to hide elements */
}

#hero-section {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    width: 100%;
    background-color: #333; /* Fallback if video fails */
    text-align: center;
    padding: 1rem;
    box-sizing: border-box;
    direction: rtl;
    position: relative; /* Needed for z-index stacking */
    overflow: hidden; /* Hide parts of iframe that overflow */
}

#video-background {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100vw; /* Full viewport width */
    height: 100vh; /* Full viewport height */
    transform: translate(-50%, -50%);
    z-index: 1; /* Behind hero content */
    pointer-events: none; /* Allow clicks to pass through */
    overflow: hidden;
}

#video-background iframe {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 120vw; /* Larger than viewport to cover */
    height: 120vh; /* Larger than viewport to cover */
    min-width: 100%; /* Ensure it covers at least the container width */
    min-height: 100%; /* Ensure it covers at least the container height */
    transform: translate(-50%, -50%);
}

/* Ensure hero content is above video */
.hero-text,
.button-container {
    position: relative;
    z-index: 2;
}

.hero-text {
    color: var(--light-color);
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.8); /* Stronger shadow for video bg */
    margin-bottom: 2rem; /* Increased margin */
    max-width: 600px; /* Constrain width for readability */
    line-height: 1.8; /* Slightly more line spacing for Hebrew */
    background-color: rgba(0, 0, 0, 0.5); /* Semi-transparent black background */
    padding: 1rem; /* Add padding around the text */
    border-radius: 8px; /* Optional: rounded corners for the background */
}

.hero-text p {
    font-size: 1.1rem; /* Adjust base font size for Hebrew */
    margin-bottom: 0.5em; /* Space between paragraphs */
}

#hero-section p {
    /* Removed original hero paragraph styles, handled by .hero-text p now */
    /* color: var(--light-color); */
    /* font-size: 1.2rem; */
    /* text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.7); */
    /* margin-bottom: 1.5rem; */
}

.button-container {
    display: flex;
    flex-direction: column; /* Stack buttons on mobile */
    gap: 1rem;
    align-items: center;
}

#play-game-btn,
#order-btn {
    padding: 0.8rem 1.5rem;
    font-size: 1rem;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    transition: background-color 0.3s ease, transform 0.1s ease;
}

#play-game-btn {
    background-color: var(--primary-color);
    color: var(--light-color);
}

#order-btn {
    background-color: var(--secondary-color);
    color: var(--light-color);
}

#play-game-btn:hover,
#order-btn:hover {
    opacity: 0.9;
}

#play-game-btn:active,
#order-btn:active {
    transform: scale(0.98);
}

/* Basic focus visibility for keyboard navigation */
*:focus-visible {
    outline: 3px solid var(--secondary-color);
    outline-offset: 2px;
}

/* Button focus styles */
#play-game-btn:focus-visible,
#order-btn:focus-visible,
#restart-btn:focus-visible {
    box-shadow: 0 0 0 3px rgba(255, 152, 0, 0.6); /* Example focus ring matching secondary color */
}

/* --- Media Queries --- */

/* Tablet */
@media (min-width: 768px) {
    header {
         /* Reset width for larger screens if needed, or adjust padding */
         width: 100%; /* Keep full width for absolute pos */
         text-align: center; /* Re-center logo for larger screens */
         padding-top: 1.5rem; /* Add more padding on larger screens */
         /* Position remains absolute */
    }
    #logo {
        max-width: 200px; /* Restore max-width for larger screens */
    }

    .hero-text p {
        font-size: 1.2rem; /* Increase size slightly on tablet */
    }

    .button-container {
        flex-direction: row; /* Buttons side-by-side */
        gap: 2rem;
    }

    #play-game-btn,
    #order-btn {
        padding: 1rem 2rem;
        font-size: 1.2rem;
    }
}

/* Desktop */
@media (min-width: 1024px) {
    #logo {
        max-width: 250px; /* Restore max-width for larger screens */
    }

    .hero-text p {
        font-size: 1.3rem; /* Increase size slightly on desktop */
    }

    /* Constrain game area on larger screens */
    #game-container {
        position: fixed;
        inset: 0; /* Shortcut for top/right/bottom/left: 0 */
        width: auto;  /* Let max-width/height control size */
        height: auto;
        max-width: 1000px;
        max-height: 700px;
        margin: auto; /* Center the container */
        border-radius: 10px; /* Optional: rounded corners */
        box-shadow: 0 0 20px rgba(0, 0, 0, 0.5); /* Optional: add shadow */
        overflow: hidden; /* Ensure canvas stays within rounded corners */
    }

    #gameCanvas {
        /* Ensure canvas fills the constrained container */
        width: 100%;
        height: 100%;
    }
}

/* --- Game Styles --- */

#game-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%; /* Default to full screen for mobile */
    height: 100%;
    background-color: #222;
    z-index: 10;
}

#gameCanvas {
    display: block;
    width: 100%; /* Default to fill container */
    height: 100%;
}

#game-ui {
    position: absolute;
    top: 10px;
    left: 10px;
    color: var(--light-color);
    font-size: 1.2rem;
    z-index: 20;
    background-color: rgba(0, 0, 0, 0.5); /* Semi-transparent background */
    padding: 0.5rem 1rem;
    border-radius: 5px;
    display: flex;
    gap: 1.5rem;
}

#game-ui span {
    font-weight: bold;
}

#restart-btn {
    position: absolute;
    top: 65%; /* Move down from center to avoid overlap */
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 30;
    background-color: var(--primary-color);
    color: var(--light-color);
    padding: 1rem 2rem;
    font-size: 1.5rem;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.1s ease;
}

#restart-btn:hover {
    opacity: 0.9;
}

#restart-btn:active {
    transform: translate(-50%, -50%) scale(0.98); /* Keep centering transform */
}

/* Styles will be added in later tasks */ 