* {
    margin: 0;
    padding: 0;
    user-select: none;
}

canvas {
    background-color: rgb(243, 235, 235);
    max-width: 100%;
    height: auto;
    display: block; /* Remove any extra space */
}

input {
    border: 3px solid rgb(17, 17, 17); /* Adjusted border size */
    border-radius: 50%; /* Circular border radius */
    width: 30px; /* Adjusted width */
    height: 30px; /* Adjusted height */
    font-size: 20px; /* Adjusted font size */
    text-align: center;
    text-transform: uppercase;
    border-image-slice: 1;
    border-image-source: linear-gradient(to left, #743ad5, #d53a9d);
    color: rgb(70, 1, 70);
    margin: 10px; /* Increased margin for more gap between boxes */
    padding: 0; /* Ensure no padding */
}

html, body {
    height: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden; /* Prevent any scrolling on the body */
}

body {
    display: flex;
    flex-direction: column;
    font-family: 'Arial', sans-serif;
    background: #f0f0f0;
    color: #333;
}

header {
    /* background: #4a9eff; */
    color: rgb(3, 3, 3);
    padding: 1rem;
    text-align: center;
}

.game-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 10px;
    gap: 15px;
    background: rgba(255, 255, 255, 0.8);
    padding: 10px 15px;
    border-radius: 30px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    max-width: 80%;
    margin-left: auto;
    margin-right: auto;
    flex-wrap: wrap; /* Allow controls to wrap on small screens */
    position: relative; /* Add positioning context */
    z-index: 10; /* Ensure controls stay above other elements */
}

footer {
    width: 100%;
    background: #4a9eff;
    color: white;
    padding: 1rem;
    text-align: center;
    flex-shrink: 0; /* Prevent footer from shrinking */
    z-index: 10;
}

#mainContainer {
    flex: 1;
    padding: 2rem;
    text-align: center;
    position: relative; /* Changed to relative positioning */
    min-height: 300px; /* Ensure minimum height */
    min-width: 300px; /* Ensure minimum width */
    margin: 0 auto;
}

.word-list {
    background: white;
    padding: 1rem;
    border-radius: 10px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}

.word-list h2 {
    margin-top: 0;
}

.word-list ul {
    list-style: none;
    padding: 0;
}

.word-list li {
    font-size: 1.2rem;
    margin: 0.5rem 0;
}

#gameContainer {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    overflow: hidden;
    position: relative; /* Ensure proper positioning context */
    padding: 20px;
    margin-top: 10px; /* Reduced margin to save vertical space */
}

#gameWindow {
    width: 100%;
    max-width: 1000px;
    height: 100%; /* Fill available space */
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    border-radius: 10px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
    position: relative; /* Ensure proper positioning */
}

.puzzle-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: auto; /* This is the only element that should scroll */
    padding: 20px;
    box-sizing: border-box;
}

.word-list {
    width: 300px;
}

select#puzzleType {
    padding: 8px 15px;
    border: 2px solid #4a9eff;
    border-radius: 25px;
    background-color: #fff;
    font-size: 16px;
    color: #333;
    outline: none;
    cursor: pointer;
    width: auto;
    transition: all 0.3s ease;
    box-shadow: 0 0 5px rgba(0, 0, 0, 0.05);
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml;utf8,<svg fill='%234a9eff' height='24' viewBox='0 0 24 24' width='24' xmlns='http://www.w3.org/2000/svg'><path d='M7 10l5 5 5-5z'/><path d='M0 0h24v24H0z' fill='none'/></svg>");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 30px;
    max-width: 100%; /* Prevent overflow on small screens */
    text-overflow: ellipsis; /* Show ellipsis for overflow text */
}

select#puzzleType:focus, select#puzzleType:hover {
    border-color: #743ad5;
    box-shadow: 0 0 8px rgba(116, 58, 213, 0.3);
}

.game-controls label {
    font-weight: bold;
    color: #333;
    font-size: 16px;
}

/* Hint letters styling */
.hint-letter {
    color: #743ad5;
    font-weight: bold;
}

/* Adjust input field positioning for scrollability */
.puzzle-input {
    position: absolute;
    /* Other styling will be maintained by existing input styles */
}

/* Media queries for mobile responsiveness */
@media (max-width: 768px) {
    #gameContainer {
        padding: 10px;
    }
    
    #gameWindow {
        margin-bottom: 20px;
        width: 100%;
        max-height: 70vh; /* Increased height for mobile */
    }
    
    canvas {
        width: 100%;
        height: auto;
    }
    
    .word-list {
        width: 100%;
        max-width: 300px;
        margin: 0 auto;
    }
    
    input {
        width: 25px;
        height: 25px;
        font-size: 16px;
        margin: 5px;
    }
    
    h1 {
        font-size: 1.5rem;
    }
    
    .game-controls {
        flex-direction: row; /* Keep as row but allow wrapping */
        gap: 8px;
        width: 90%;
        padding: 8px 12px;
        max-width: 90%;
        position: sticky; /* Make controls stick to their position */
        top: 0;
    }
    
    select#puzzleType {
        width: 100%; /* Full width for select */
        min-width: 150px;
        font-size: 15px;
        padding: 7px 10px;
        padding-right: 30px; /* Make room for dropdown arrow */
        max-width: none; /* Override previous max-width */
    }
    
    .game-controls label {
        font-size: 14px;
        width: 100%; /* Full width for label */
        text-align: center;
        margin-bottom: 5px;
    }
}

@media (max-width: 480px) {
    #mainContainer {
        padding: 1rem;
    }
    
    input {
        width: 22px;
        height: 22px;
        font-size: 14px;
        margin: 3px;
    }
    
    .word-list h2 {
        font-size: 1.2rem;
    }
    
    .word-list li {
        font-size: 1rem;
    }
    
    .game-controls {
        width: 95%;
        max-width: 95%;
        padding: 6px 10px;
        margin-bottom: 10px;
    }
    
    select#puzzleType {
        font-size: 14px;
        padding: 6px 10px;
        padding-right: 25px;
    }
    
    header h1 {
        margin-bottom: 10px; /* Add some spacing below the title */
    }
}