body {
    font-family: sans-serif;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background-color: #f0f0f0;
    margin: 0;
    color: #333;
    overflow: hidden; /* Prevent body scrolling when custom cursor is active */
}

.container {
    background-color: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    text-align: center;
    display: flex; /* Use flexbox for better layout of internal elements */
    flex-direction: column;
    gap: 15px; /* Space between sections */
}

h1 {
    margin-bottom: 0; /* Adjust margin as gap handles spacing */
    color: #007bff;
}

.controls {
    display: flex;
    justify-content: center;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap; /* Allow controls to wrap on smaller screens */
}

.actions {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
}

#colorPicker {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    width: 60px;
    height: 40px;
    background-color: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
}

#colorPicker::-webkit-color-swatch-wrapper {
    padding: 0;
}

#colorPicker::-webkit-color-swatch {
    border: 2px solid #ccc;
    border-radius: 4px;
}

#colorPicker::-moz-color-swatch {
    border: 2px solid #ccc;
    border-radius: 4px;
}

button {
    padding: 10px 15px;
    border: none;
    border-radius: 5px;
    background-color: #007bff;
    color: white;
    cursor: pointer;
    font-size: 1em;
    transition: background-color 0.2s ease;
}

button:hover {
    background-color: #0056b3;
}

.palette-container {
    margin: 10px 0;
    display: flex;
    justify-content: center;
}

.color-palette {
    display: grid;
    grid-template-columns: repeat(8, 1fr); /* 8 colors per row */
    gap: 5px;
    padding: 5px;
    border: 1px solid #ddd;
    border-radius: 5px;
    background-color: #f9f9f9;
}

.color-swatch {
    width: 25px;
    height: 25px;
    border: 1px solid #ccc;
    border-radius: 3px;
    cursor: pointer;
    transition: transform 0.1s ease, box-shadow 0.1s ease;
}

.color-swatch:hover {
    transform: scale(1.1);
    box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);
}

.grid-container {
    display: grid;
    background-color: #eee; /* This will be the "default" background where pixels aren't colored */
    margin: 0 auto;
    border: 1px solid #ccc; /* Overall grid border */
    transition: border 0.1s ease;
    cursor: none; /* Hide default cursor when over the grid */
}

.pixel {
    width: 20px; /* Adjust pixel size as needed */
    height: 20px; /* Adjust pixel size as needed */
    background-color: white; /* Default pixel color */
    box-sizing: border-box; /* Include padding and border in the element's total width and height */
    border: 0.5px solid #e0e0e0; /* Subtle default pixel border */
    transition: background-color 0.05s linear, border 0.1s ease; /* Smooth transition for coloring and border toggle */
}

/* Class to remove borders for grid toggle */
.grid-container.no-grid-lines .pixel {
    border: none;
}

.custom-cursor {
    position: absolute;
    width: 24px; /* Adjust size as needed for the cursor image */
    height: 24px; /* Adjust size as needed for the cursor image */
    background-image: url('roblox.png');
    background-size: contain;
    background-repeat: no-repeat;
    pointer-events: none; /* Important: Allows events to pass through to elements below */
    display: none; /* Hidden by default */
    z-index: 1000; /* Ensure it's on top of other content */
    /* Adjust transform to position the tip of the arrow accurately relative to the touch/mouse point */
    /* Assuming roblox.png is an arrow pointing up-right, we want the bottom-left of the image at the cursor point. */
    transform: translate(-10%, -90%); /* Example: shift left 10%, up 90% */
}

/* --- Animation Specific Styles --- */
.animation-area {
    display: flex;
    flex-direction: column;
    gap: 15px;
    align-items: center;
}

.animation-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

#fpsRange {
    width: 100px;
}

.animation-grid-container {
    display: grid;
    background-color: #eee;
    margin: 0 auto;
    border: 1px solid #ccc;
    transition: border 0.1s ease;
    cursor: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.animation-grid-container .pixel {
    width: 40px; /* Larger pixels for 7x7 grid */
    height: 40px;
    border: 0.5px solid #e0e0e0;
}

/* --- New 9x9 Art Specific Styles --- */
.nine-by-nine-area {
    display: flex;
    flex-direction: column;
    gap: 15px;
    align-items: center;
}

.nine-by-nine-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.nine-by-nine-grid-container {
    display: grid;
    background-color: #eee;
    margin: 0 auto;
    border: 1px solid #ccc;
    transition: border 0.1s ease;
    cursor: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.nine-by-nine-grid-container .pixel {
    width: 30px; /* Pixel size for 9x9 grid */
    height: 30px;
    border: 0.5px solid #e0e0e0;
}

.hidden {
    display: none !important;
}