html {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
}

body {
    margin: 0;
    padding: 0;
    width: 100%;
    /* Default is auto, unless overridden by specific page class */
    overflow-y: auto;
    background-color: black; /* Default background color, will be overridden by JS for index.html */
    font-family: 'Arial', sans-serif; /* Set a default font for the body */
    color: #333; /* Default text color */
}

/* For the interactive face page (index.html), ensure no scrolling */
body.face-page {
    overflow: hidden; /* Prevent scrolling specifically for the face page */
}

/* New: Styles for the new home.html */
.home-page {
    background-color: #f0f0f0; /* Light background for the home page */
    color: #333;
    overflow-y: auto; /* Ensure scrolling is allowed on home page */
}

/* New: Styles for the new versions.html and how-to-play.html */
.versions-page {
    background-color: #e0e0e0; /* A neutral background for versions page */
    color: #333;
    padding: 20px; /* Add some padding */
    display: flex; /* Use flexbox to center content */
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 100vh; /* Ensure it takes full viewport height */
    text-align: center;
}

.versions-page h1 {
    font-size: 2.5em;
    color: #1d3557;
    margin-bottom: 20px;
    text-align: center;
}

.versions-page p {
    font-size: 1.1em;
    line-height: 1.6;
    color: #444;
    max-width: 800px;
    margin: 0 auto 10px auto; /* Center paragraphs */
    text-align: center;
}

/* New: Styles for list in how-to-play.html */
.versions-page ul {
    list-style: none; /* Remove bullet points */
    padding: 0;
    margin: 20px auto 30px auto;
    max-width: 700px;
    text-align: left; /* Align list items left */
    font-size: 1.1em;
    line-height: 1.8;
}

.versions-page ul li {
    background-color: #f9f9f9;
    border-left: 5px solid #4CAF50; /* Green highlight on left */
    margin-bottom: 10px;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.versions-page ul li strong {
    color: #1d3557; /* Dark blue for emphasized text */
}

/* New: Styles for version buttons */
.version-buttons {
    margin-top: 30px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.version-button {
    display: inline-block;
    background-color: #4CAF50; /* Green button */
    color: white;
    padding: 15px 30px;
    text-decoration: none;
    border-radius: 8px;
    font-size: 1.3em;
    font-weight: bold;
    transition: background-color 0.3s ease, transform 0.2s ease;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.version-button:hover {
    background-color: #45a049;
    transform: translateY(-2px);
}

.main-container {
    display: grid;
    grid-template-columns: 1fr 1fr; /* Two columns */
    grid-template-rows: auto auto auto auto; /* Four rows: top image, carousel/text, pick version, empty (if interact-section removed) */
    gap: 40px; /* Space between sections */
    padding: 50px;
    max-width: 1200px;
    margin: 0 auto; /* Center the container */
    align-items: center;
    min-height: 100vh; /* Ensure it takes full viewport height */
}

@media (max-width: 900px) {
    .main-container {
        grid-template-columns: 1fr; /* Single column on smaller screens */
        grid-template-rows: auto auto auto auto; /* Four rows: top image, carousel, text, pick version */
        padding: 20px;
        gap: 20px;
    }
}

/* New: Style for the top image */
#top-image {
    grid-column: 1 / 3; /* Spans both columns */
    grid-row: 1 / 2; /* First row */
    max-width: 60%; /* Make the image smaller */
    height: auto;
    margin-bottom: 20px; /* Space below the image */
    justify-self: center; /* Center horizontally within its grid area */
    border-radius: 15px; /* Rounded corners for the image */
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1); /* Subtle shadow */
}

@media (max-width: 900px) {
    #top-image {
        grid-column: 1 / 2; /* Full width on small screens */
        grid-row: 1 / 2; /* Top row on small screens */
    }
}

#image-carousel {
    grid-column: 1 / 2; /* First column */
    grid-row: 2 / 5; /* Spans multiple rows on large screens, shifted down by 1 */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background-color: #eee;
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
    position: relative;
    overflow: hidden; /* Hide parts of image when it transitions */
}

@media (max-width: 900px) {
    #image-carousel {
        grid-column: 1 / 2; /* Full width on small screens */
        grid-row: 2 / 3; /* Second row on small screens */
    }
}

#carousel-image {
    max-width: 100%;
    height: auto;
    border-radius: 10px;
    object-fit: contain; /* Ensure the whole image is visible */
    max-height: 500px; /* Limit image height */
    transition: opacity 0.5s ease-in-out;
}

#carousel-dots {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.dot {
    width: 12px;
    height: 12px;
    background-color: #ccc;
    border-radius: 50%;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.dot.active {
    background-color: #457b9d; /* Active dot color */
}

#text-content {
    grid-column: 2 / 3; /* Second column */
    grid-row: 2 / 3; /* Second row (was 1/2) */
    text-align: left;
    padding: 20px;
    background-color: white;
    border-radius: 15px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
}

@media (max-width: 900px) {
    #text-content {
        grid-column: 1 / 2; /* Full width on small screens */
        grid-row: 3 / 4; /* Third row (was 2/3) */
    }
}

#text-content h1 {
    font-size: 2.5em;
    color: #1d3557; /* Dark blue heading */
    margin-bottom: 15px;
}

#text-content p {
    font-size: 1.1em;
    line-height: 1.6;
    color: #444;
    margin-bottom: 10px;
}

#pick-version-section {
    grid-column: 2 / 3; /* Second column */
    grid-row: 3 / 4; /* Third row (was 2/3) */
    display: flex;
    justify-content: center;
    align-items: flex-start; /* Align button to top of its cell */
    padding: 20px;
}

@media (max-width: 900px) {
    #pick-version-section {
        grid-column: 1 / 2; /* Full width on small screens */
        grid-row: 4 / 5; /* Fourth row (was 3/4) */
        align-items: center; /* Center button vertically in its cell */
    }
}

.home-button { /* General style for home page buttons */
    display: inline-block;
    background-color: #4CAF50; /* Green */
    color: white;
    padding: 18px 35px;
    text-decoration: none;
    border-radius: 10px;
    font-size: 1.5em;
    font-weight: bold;
    transition: background-color 0.3s ease, transform 0.2s ease;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.home-button:hover {
    background-color: #45a049;
    transform: translateY(-3px);
}

/* New: Navigation Bar */
#navbar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 60px; /* Fixed height for the navbar */
    background-color: #333;
    color: white;
    display: flex;
    justify-content: space-between; /* Space out items */
    align-items: center;
    padding: 0 20px;
    box-sizing: border-box; /* Include padding in width/height */
    z-index: 99; /* Below overlays (z-index 100), above face (z-index up to 8) */
    transition: transform 0.3s ease-in-out; /* Smooth transition for hiding/showing */
}

#navbar.hidden {
    transform: translateY(-100%); /* Move completely off-screen upwards */
}

#navbar .nav-links {
    display: flex; /* Use flexbox to align nav links */
    align-items: center;
    flex-grow: 1; /* Allow nav-links to take available space */
    justify-content: flex-end; /* Push links to the right */
}

#navbar .nav-links a {
    color: white;
    text-decoration: none;
    font-family: 'Arial', sans-serif;
    font-size: 1.1em;
    padding: 10px 15px;
    margin-left: 15px; /* Space between links */
    border-radius: 5px;
    transition: background-color 0.2s ease;
}

#navbar .nav-links a:hover {
    background-color: #555;
}

/* New: Style for Battery Status */
#battery-status, #volume-level-display {
    color: white;
    font-family: 'Arial', sans-serif;
    font-size: 1.1em;
    margin-left: 15px; /* Space from other nav items */
    padding: 10px 15px;
    background-color: rgba(255, 255, 255, 0.1); /* Slightly visible background */
    border-radius: 5px;
    display: flex; /* Use flex to align icon and text */
    align-items: center;
    gap: 5px; /* Space between icon and text */
    transition: opacity 0.3s ease-out; /* Smooth transition for hidden class */
}

/* Hide battery status if .hidden is applied */
#battery-status.hidden, #volume-level-display.hidden {
    opacity: 0;
    pointer-events: none; /* Make it non-interactive when hidden */
}

/* New: Style for Navbar Close button */
#navbar-close-button {
    background-color: transparent; /* Transparent background */
    color: white; /* White 'X' */
    border: none;
    font-size: 1.8em; /* Larger 'X' */
    cursor: pointer;
    padding: 5px 10px; /* Adjust padding */
    margin-right: auto; /* Push button to the left, allowing nav links to go right */
    transition: background-color 0.2s ease;
    border-radius: 50%; /* Changed to make it circular */
    line-height: 1; /* Vertically center the 'X' */
}

#navbar-close-button:hover {
    background-color: rgba(255, 255, 255, 0.2); /* Slight background on hover */
}

/* New: Navigation toggle button (☰) style */
#nav-toggle-button {
    position: fixed;
    top: 15px; /* Adjust as needed */
    left: 15px; /* Adjust as needed */
    z-index: 50; /* Ensure it's above the face but below overlays */
    padding: 10px 15px;
    background-color: black; /* Changed to black background */
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-family: 'Arial', sans-serif;
    font-size: 1.5em; /* Make the hamburger icon larger */
    transition: background-color 0.2s ease, opacity 0.3s ease-out; /* Add opacity to transition */
}

#nav-toggle-button:hover {
    background-color: #555; /* Darker on hover */
}

#face {
    position: relative;
    width: 100vw;
    /* Default (navbar hidden) state for face, will be overridden by .navbar-active */
    height: 100vh;
    top: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: top 0.3s ease-in-out, height 0.3s ease-in-out, transform 0.1s ease-out; /* Add transform transition for smooth movement */
    --mouth-outline-color: white; /* New CSS variable for mouth outline */
}

/* Adjust face position when the navbar is visible (body has navbar-active class) */
body.navbar-active #face {
    top: 60px; /* Push face down below navbar */
    height: calc(100vh - 60px); /* Adjust height to fill remaining space below navbar */
}

.eye {
    width: 40vmin;
    height: 40vmin;
    background-color: white;
    border-radius: 50%;
    position: absolute;
    border: calc(0.7vmin + 2px) solid black;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

/* New: Inner circle within the eye */
.eye-inner-circle {
    position: absolute;
    width: 25vmin; /* Smaller iris */
    height: 25vmin; /* Smaller iris */
    /* Changed to copper color, adding radial gradient for 3D effect */
    background: radial-gradient(circle at 35% 35%, #D49D6B 0%, #B87333 70%, #8A593A 100%);
    border-radius: 50%;
    border: calc(0.2vmin + 1px) solid black; /* Thin black outline for iris */
    z-index: 0; /* Ensures it's behind the pupil and eyelids */
    /* Add transition for smoother color changes */
    transition: background 0.3s ease-in-out, transform 0.2s ease-in-out;
}

#left-eye {
    top: 30%;
    left: 35%;
    transform: translate(-50%, -50%);
}

#right-eye {
    top: 30%;
    left: 65%;
    transform: translate(-50%, -50%);
}

.pupil {
    width: 8vmin; /* Smaller pupil */
    height: 8vmin; /* Smaller pupil */
    background-color: black; /* Changed to black */
    border-radius: 50%; /* Maintains oval shape */
    position: absolute;
    border: calc(0.4vmin + 1px) solid black;
    transition: transform 0.2s ease-in-out, border-radius 0.2s ease-in-out; /* Add border-radius to transition */
    z-index: 1;
}

.eyelid {
    position: absolute;
    width: 100%;
    height: 50%;
    background-color: black; /* Default eyelid color, will be overridden by JS */
    z-index: 4; /* Changed from 2 to 4 to be in front of glares (z-index: 3) */
    transition: transform 0.2s ease-out, box-shadow 0.2s ease-out, background-color 0.3s ease-in-out, border-color 0.3s ease-in-out; /* Add background-color and border-color to transition */
    box-sizing: border-box; /* Ensure border is included in element's dimensions */
    border: calc(0.1vmin + 0.5px) solid white; /* Thin white outline for eyelids */
}

.top-lid {
    top: 0;
    transform: translateY(-100%);
    /* Shadow for top lid, casting downwards onto the eye when closing */
    box-shadow: none; /* Removed shadow */
}

.bottom-lid {
    bottom: 0;
    transform: translateY(100%);
    /* Shadow for bottom lid, casting upwards onto the eye when closing */
    box-shadow: none; /* Removed shadow */
}

/* New: Eyelids for squinting */
.eyelid.squinted.top-lid {
    transform: translateY(-30%); /* Move top lid down */
}

.eyelid.squinted.bottom-lid {
    transform: translateY(30%); /* Move bottom lid up */
}

/* New Glare Styles */
.eye-glare {
    position: absolute;
    background-color: rgba(255, 255, 255, 0.7); /* White, semi-transparent */
    border-radius: 50%; /* Make it round */
    z-index: 3; /* Above pupil/iris, below eyelids */
}

.eye-glare.glare-1 {
    width: 6vmin;
    height: 6vmin;
    top: 15%;
    left: 15%;
    filter: blur(1px); /* Slightly blur for a softer look */
}

.eye-glare.glare-2 {
    width: 3vmin;
    height: 3vmin;
    top: 40%;
    left: 40%;
    filter: blur(0.5px); /* Smaller, slightly sharper highlight */
    transform: rotate(45deg); /* Optional: add a slight rotation for variety */
}

#nose {
    width: 10vmin; /* Smaller nose */
    height: 8vmin; /* Smaller nose */
    background-color: #ffafcc; /* Cute pink color for cat nose */
    position: absolute;
    top: calc(60%); /* Moved nose down to be closer to mouth */
    left: 50%;
    transform: translate(-50%, -50%);
    /* Changed border-radius for a more triangular, cat-like shape */
    border-radius: 50% 50% 50% 50% / 30% 30% 70% 70%; /* Flipped vertical radii for pointy top, round bottom */
    border: calc(0.5vmin + 1px) solid white;
    cursor: pointer; /* Make it clear it's clickable */
    z-index: 8; /* Ensure nose is above whiskers and mouth outline */
    transition: transform 0.1s ease-out, background-color 0.3s ease-in-out; /* Add background-color to transition */
}

/* Nostrils */
#nose::before,
#nose::after {
    content: '';
    position: absolute;
    width: 1.5vmin; /* Width of nostril */
    height: 2vmin; /* Height of nostril */
    background-color: #333; /* Dark color for nostrils */
    border-radius: 50%; /* Make them oval/circular */
    bottom: 20%; /* Position from the bottom of the nose */
    z-index: 9; /* Ensure nostrils are on top of the nose body */
}

#nose::before {
    left: 20%; /* Position for left nostril */
    transform: rotate(10deg); /* Slight rotation for a natural look */
}

#nose::after {
    right: 20%; /* Position for right nostril */
    transform: rotate(-10deg); /* Slight rotation for a natural look */
}

/* New: Squeezed nose animation */
#nose.squeezed {
    transform: translate(-50%, -50%) scaleX(0.9) scaleY(1.1); /* Squeeze horizontally, stretch vertically */
    /* Adjust border-radius to emphasize squeeze, keeping the general shape */
    border-radius: 50% 50% 50% 50% / 40% 40% 60% 60%; /* Flipped vertical radii */
}

/* New Whisker Styles */
.whiskers-group {
    position: absolute;
    top: 68%; /* Moved lower, under the eyes and further from the nose */
    width: 15vmin; /* Make whiskers longer */
    height: 10vmin; /* Smaller height to accommodate spread of whiskers */
    transform: translateY(-50%); /* Vertically center with top */
    pointer-events: none; /* Make them not intercept clicks */
    z-index: 5; /* Below nose, above mouth inner elements */
}

#whiskers-left {
    /* Position the right edge of this group at the left edge of the nose */
    left: calc(50% - 20vmin); /* Adjusted based on new length to align with nose edge */
}

#whiskers-right {
    /* Position the left edge of this group at the right edge of the nose */
    left: calc(50% + 5vmin); /* Adjusted to align with nose edge */
}

/* Individual whisker positions and rotations for left side */
#whiskers-left .whisker-1 {
    top: 35%; /* Top whisker */
    transform: rotate(15deg); 
}

#whiskers-left .whisker-2 {
    top: 50%; /* Middle whisker, straight */
    transform: rotate(0deg);
}

#whiskers-left .whisker-3 {
    top: 65%; /* Bottom whisker */
    transform: rotate(-15deg);
}

/* Individual whisker positions and rotations for right side */
#whiskers-right .whisker-1 {
    top: 35%; /* Top whisker */
    transform: rotate(-15deg); 
}

#whiskers-right .whisker-2 {
    top: 50%; /* Middle whisker, straight */
    transform: rotate(0deg);
}

#whiskers-right .whisker-3 {
    top: 65%; /* Bottom whisker */
    transform: rotate(15deg);
}

/* New: Add shadow to whiskers */
.whisker {
    position: absolute;
    background-color: white; /* Color of whiskers */
    height: 0.75vmin; /* Thickness of the whisker */
    width: 100%;
    border-radius: 9999px; /* Rounded ends */
    box-shadow: none; /* Removed shadow */
    transition: background-color 0.3s ease; /* Add transition for color changes */
}

#whiskers-left .whisker {
    transform-origin: 100% center; /* Rotate around the right end (point closest to nose) */
    right: 0; /* Position at the right edge of the whiskers-group container */
}

#whiskers-right .whisker {
    transform-origin: 0% center; /* Rotate around the left end (point closest to nose) */
    left: 0; /* Position at the left edge of the whiskers-group container */
}

#mouth {
    width: 26vmin; /* Adjusted to make it rounder */
    height: 20vmin; /* Adjusted to make it rounder */
    position: absolute;
    top: calc(70%); /* Adjusted to be closer to the new nose position */
    left: 50%;
    transform: translate(-50%, -50%);
    border: none;
    border-radius: 50%;
    transition: all 0.2s ease-out;
    background-color: transparent;
    clip-path: none;
    animation: idleMouth 0.75s ease-in-out infinite; /* Faster animation */
    cursor: pointer;
    z-index: 7; /* Mouth should be in front of the line */
}

#mouth::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    box-sizing: border-box;
    border: calc(0.6vmin + 2px) solid var(--mouth-outline-color); /* Use CSS variable here */
    border-top-color: transparent;
    border-left-color: transparent;
    border-right-color: transparent;
    border-radius: 50%;
    transition: all 0.2s ease-out;
    pointer-events: none;
    z-index: 3; /* Bring outline to front */
}

#mouth.ouch {
    transform: translate(-50%, -50%) rotate(180deg);
    top: calc(70% + 3vmin); /* Adjusted based on new mouth position for pain reaction */
}

#mouth.surprised {
    width: 12vmin; /* Shrink the mouth */
    height: 12vmin; /* Shrink the mouth */
    background-color: #9b2226; /* Dark red for inside mouth */
    clip-path: circle(50% at 50% 50%);
    animation: none;
    top: calc(70% + 4vmin); /* Adjusted to move the circular mouth to the middle of the closed mouth */
    box-shadow: none; /* Removed shadow */
}

#mouth.surprised::after {
    border: none; /* Remove the outline for the surprised mouth to bring the circle mouth in front */
    box-shadow: 0 0 0 rgba(0, 0, 0, 0); /* Hide shadow when mouth is surprised */
}

.teeth-row, .tongue {
    position: absolute;
    opacity: 0;
    transition: opacity 0.2s ease-out;
    z-index: 4; /* Ensure teeth and tongue are above mouth background but below outline */
}

#mouth.surprised .teeth-row,
#mouth.surprised .tongue {
    opacity: 1;
}

.teeth-row {
    background-color: #d0d0d0; /* A bit darker than pure white */
    width: 100%;
    height: 2vmin; /* Shrink teeth height */
    left: 0;
}

.top-teeth {
    top: 0;
    border-radius: 0 0 10px 10px;
}

.bottom-teeth {
    bottom: 0;
    border-radius: 10px 10px 0 0;
    z-index: 5; /* Ensure bottom teeth are in front of the tongue */
}

.tongue {
    width: 7vmin; /* Shrink tongue width */
    height: 7vmin; /* Shrink tongue height */
    background-color: #e56b6f; /* Pinkish tongue */
    border-radius: 50%;
    left: 50%;
    bottom: 0;
    transform: translate(-50%, 15%); /* Reduce vertical offset slightly to keep it more inside */
    z-index: 4; /* Explicitly set tongue z-index to ensure correct layering with teeth */
}

@keyframes idleMouth {
    0%, 100% {
        transform: translate(-50%, -50%) scaleY(1);
    }
    50% {
        transform: translate(-50%, -52%) scaleY(1.1);
    }
}

#mic-status {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 10px 15px;
    border-radius: 5px;
    font-family: sans-serif;
    font-size: 1.2em;
    z-index: 10;
}

#conversation-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8); /* Semi-transparent black background */
    display: flex; /* Use flexbox to center content */
    justify-content: center;
    align-items: center;
    z-index: 100; /* Ensure it's on top of everything */
}

#conversation-box {
    background-color: #333;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);
    text-align: center;
    max-width: 80%;
    width: 400px;
}

#conversation-message {
    color: white;
    font-family: 'Arial', sans-serif;
    font-size: 1.8em;
    margin-bottom: 20px;
}

#conversation-input {
    width: calc(100% - 30px); /* Account for padding */
    padding: 15px;
    border: none;
    border-radius: 8px;
    font-family: 'Arial', sans-serif;
    font-size: 1.2em;
    outline: none; /* Remove default outline */
    background-color: #555;
    color: white;
    caret-color: white; /* Color of the text cursor */
}

#conversation-input::placeholder {
    color: #bbb;
}

#conversation-buttons {
    margin-top: 20px;
    display: flex;
    justify-content: space-around;
    gap: 15px; /* Space between buttons */
}

#conversation-buttons button {
    padding: 12px 25px;
    border: none;
    border-radius: 8px;
    font-family: 'Arial', sans-serif;
    font-size: 1.2em;
    cursor: pointer;
    transition: background-color 0.2s ease;
    flex-grow: 1; /* Allow buttons to grow and fill space */
}

/* New: General style for buttons in overlays */
.digital-button {
    padding: 10px 20px;
    border: 2px solid; /* Solid border */
    border-radius: 5px;
    font-family: 'Arial', sans-serif; /* Keep consistent font */
    font-size: 0.9em;
    cursor: pointer;
    text-transform: uppercase;
    transition: all 0.1s ease;
    box-shadow: 0 3px 0px rgba(0,0,0,0.4); /* Outset shadow for depth */
    position: relative;
    top: 0;
    left: 0;
}

.digital-button:active {
    top: 2px; /* Simulate pressing down */
    box-shadow: 0 1px 0px rgba(0,0,0,0.4); /* Smaller shadow when pressed */
}

/* Primary buttons (e.g., Confirm, Close, Apply Image) */
.digital-button-primary {
    background-color: #4CAF50; /* Green */
    color: white;
    border-color: #3e8e41; /* Darker green border */
}

.digital-button-primary:hover {
    background-color: #45a049;
}

/* Secondary buttons (e.g., Cancel, Clear Image) */
.digital-button-secondary {
    background-color: #f44336; /* Red */
    color: white;
    border-color: #da190b; /* Darker red border */
}

.digital-button-secondary:hover {
    background-color: #d32f2f;
}

/* Warning buttons (e.g., Reset All Colors) */
.digital-button-warning {
    background-color: #FFC107; /* Amber/Yellow for reset */
    color: #333; /* Dark text for contrast */
    border-color: #e0a800;
}
.digital-button-warning:hover {
    background-color: #e0a800;
}

/* Apply digital button style to specific existing buttons that weren't assigned classes directly */
#confirm-button, #cancel-button {
    /* These buttons are in conversation overlay and will use the .digital-button class as a base */
    /* They have specific background colors set, so they'll implicitly override the base .digital-button background if that class is also added to them. */
}
/* Ensure these buttons receive the border/shadow styling */
#confirm-button {
    border: 2px solid #3e8e41;
    box-shadow: 0 3px 0px rgba(0,0,0,0.4);
}
#confirm-button:active {
    top: 2px;
    box-shadow: 0 1px 0px rgba(0,0,0,0.4);
}
#cancel-button {
    border: 2px solid #da190b;
    box-shadow: 0 3px 0px rgba(0,0,0,0.4);
}
#cancel-button:active {
    top: 2px;
    box-shadow: 0 1px 0px rgba(0,0,0,0.4);
}

/* New: Settings button style (adjusted for new position) */
#settings-button {
    position: fixed; /* Make it fixed for top-left positioning */
    top: 15px;
    /* Position to the right of nav-toggle-button + gap */
    left: calc(15px + 45px + 10px); /* 15px (nav-toggle-button left) + 45px (nav-toggle-button width) + 10px (gap) */
    z-index: 50; /* Same z-index as nav-toggle-button */
    padding: 10px 15px;
    background-color: transparent; /* Make transparent */
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-family: 'Arial', sans-serif;
    font-size: 1em;
    transition: background-color 0.2s ease, opacity 0.3s ease-out; /* Add opacity to transition */
}

#settings-button:hover {
    background-color: rgba(255, 255, 255, 0.1); /* Subtle hover effect for transparent button */
}

/* New: Settings overlay and box styles, similar to conversation */
#settings-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7); /* Slightly less opaque */
    display: flex; /* Use flexbox for internal layout */
    justify-content: center;
    align-items: center;
    z-index: 100;
}

#settings-box {
    background-color: #2a2a2a; /* Darker grey for a sleek look */
    padding: 25px;
    border-radius: 15px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);
    text-align: center;
    max-width: 900px; /* Increase max-width to give more space */
    width: auto;
    max-height: 90vh;
    overflow-y: auto;
    display: flex; /* Use flexbox for internal layout */
    flex-direction: column; /* Stack children vertically */
    gap: 20px; /* Space between elements */
    padding-block: 20px;
    align-items: center; /* Center items horizontally within the column */
}

/* New: Style for custom preset info text */
#custom-preset-info {
    color: white; /* Change text color to white as requested */
    font-size: 0.9em;
    margin-top: 0;
    margin-bottom: 10px;
    text-align: center;
}

/* New: Color Presets Section */
#color-presets-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)); /* Responsive grid for buttons */
    gap: 8px; /* Space between preset buttons */
    width: 100%;
}

/* New: Style for setting groups */
.setting-group {
    background-color: #3c3c3c; /* Slightly lighter background for groups */
    border-radius: 8px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px; /* Gap between setting items within a group */
    box-shadow: inset 0 0 5px rgba(0,0,0,0.3); /* Subtle inner shadow */
    border: 1px solid #4a4a4a; /* Subtle border */
    margin-bottom: 20px; /* Add margin between groups */
}

.setting-group h3 {
    color: #8BC34A; /* Light green for group titles */
    font-size: 1.3em;
    margin: 0 0 10px 0;
    text-align: left;
    padding-bottom: 8px;
    border-bottom: 1px dashed #555; /* Dashed separator */
}

.setting-item {
    display: flex;
    flex-direction: column;
    gap: 8px; /* Space between label and color palette/input */
    align-items: flex-start; /* Align label and content to the left */
}

.setting-item label {
    color: #c0c0c0; /* Lighter grey for labels */
    font-size: 1em;
    font-weight: bold;
    margin-bottom: 0; /* No extra margin, gap handles it */
}

.color-swatch {
    width: 30px; /* Slightly larger swatches */
    height: 30px;
    border: 2px solid #555; /* Border around swatches */
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.color-swatch:hover {
    border-color: #8BC34A; /* Highlight on hover */
    transform: scale(1.05);
}

/* Styles for color picker inputs */
input[type="color"] {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    width: 35px; /* Keep small, but slightly larger for clickability */
    height: 35px;
    background-color: transparent;
    border: none;
    padding: 0;
    border-radius: 5px; /* Slight roundness */
    cursor: pointer;
    outline: none; /* Remove default outline */
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
    transition: box-shadow 0.2s ease;
}

input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 0;
}
input[type="color"]::-webkit-color-swatch {
    border: 1px solid #555; /* Match swatch border */
    border-radius: 4px; /* Match input border-radius */
}
input[type="color"]::-moz-color-swatch {
    border: 1px solid #555;
    border-radius: 4px;
}
input[type="color"]:hover {
    box-shadow: 0 0 0 2px #8BC34A; /* Highlight on hover */
}

/* Text inputs for URL and File */
.setting-item input[type="text"],
.setting-item input[type="file"] {
    width: 100%; /* Take full width of parent .setting-item */
    padding: 10px;
    border: 1px solid #555;
    border-radius: 5px;
    background-color: #4a4a4a;
    color: #e0e0e0; /* Lighter text color for contrast */
    font-size: 1em;
    box-sizing: border-box; /* Include padding in width */
    margin-top: 5px; /* Small space below label */
}
.setting-item input[type="text"]::placeholder {
    color: #999;
}
.setting-item input[type="text"]:focus,
.setting-item input[type="file"]:focus-within { /* For file input, focus-within works better */
    outline: none;
    border-color: #4CAF50;
    box-shadow: 0 0 5px rgba(76, 175, 80, 0.5);
}

/* Background image buttons container */
#background-image-buttons {
    display: flex;
    gap: 10px;
    margin-top: 10px;
    width: 100%; /* Take full width of parent */
}

/* Overall settings buttons at the bottom */
#settings-buttons {
    margin-top: 25px; /* More space from content */
    display: flex;
    justify-content: center;
    gap: 20px; /* Space between buttons */
    width: 100%;
}

#settings-buttons button {
    flex-grow: 0; /* Don't grow too much */
    min-width: 120px; /* Ensure a minimum width for buttons */
}

#settings-save-info {
    font-size: 0.9em;
    color: #aaa;
    font-style: italic;
    margin-top: 10px;
    margin-bottom: 0; /* Remove default paragraph margin */
}

/* Adjust preview section to fit new layout */
#face-preview-setting {
    /* Already has label, now just ensure spacing */
    margin-bottom: 0; /* Remove extra margin if any */
}

#face-preview-container {
    width: 200px; /* Fixed width for the preview area */
    height: 200px; /* Fixed height */
    position: relative;
    overflow: hidden; /* Important to clip scaled content */
    border-radius: 10px;
    background-color: black; /* Default preview background, will be set by JS */
    flex-shrink: 0; /* Prevent it from shrinking */
    box-shadow: 0 0 15px rgba(0,0,0,0.6); /* More prominent shadow */
    margin: 0 auto; /* Center the preview */
    margin-top: 10px; /* Space from label */
}

@media (max-width: 768px) {
    #settings-box {
        max-width: 95%; /* Allow it to take more width on smaller screens */
        padding: 15px;
    }

    #settings-content-flex-container {
        flex-direction: column; /* Stack columns vertically */
        gap: 20px;
    }

    #settings-left-column, #settings-right-column {
        flex: 1 1 auto; /* Allow columns to take full width */
        max-width: 100%;
        align-self: stretch; /* Stretch to fill available width */
    }

    #settings-right-column {
        order: -1; /* Place preview at the top on small screens */
    }

    #face-preview-container {
        width: 180px; /* Slightly smaller preview */
        height: 180px;
    }

    .setting-group {
        padding: 15px;
        gap: 10px;
    }

    .setting-group h3 {
        font-size: 1.2em;
    }

    .digital-button {
        padding: 8px 15px;
        font-size: 0.8em;
    }

    #settings-buttons button {
        min-width: unset; /* Remove min-width on small screens */
        flex-grow: 1; /* Allow buttons to grow */
    }
}