:root {
    --control-triangle-color: white; /* Default color, will be changed in JS */
    --control-button-color: #555; /* Default button background color */
    --control-hover-color: #777; /* Default hover color */
    --control-gradient-dark: rgba(0,0,0,0.7); /* Dark color for gradient */
    --share-button-bg-color: #007bff; /* Default blue */
    --share-button-hover-color: #0056b3; /* Default darker blue */
}

* {
    box-sizing: border-box; /* Include padding and border in element's total width/height */
    margin: 0; /* Reset default margins */
    padding: 0; /* Reset default padding */
}

html, body {
    width: 100%;
    overflow-x: hidden; /* Prevent horizontal scrolling */
}

body {
    display: flex;
    flex-direction: column;
    align-items: center;
    font-family: 'Delius', cursive; /* Apply game font */
    background-color: #f0f0f0;
    text-align: center;
}

input {
    font-family: inherit; /* Apply game font */
    font-size: 1.1em;

}

.avatar {
    background: grey;
    padding: 10px;
}

.no-scores{
    font-family: inherit; /* Apply game font */
    color: darkgreen;
}
#game-container {
    /* position: relative; No longer needed */
    border: 2px solid #333;
    margin: auto;
    max-width: 100%; /* Ensure container doesn't overflow screen */
    width: 800px; /* Maintain intrinsic width for aspect ratio scaling */
    /* padding-top: 45px; Removed */
}

#gameCanvas {
    display: block; /* Removes extra space below canvas */
    background-color: #d3d3d3; /* Light grey background */
    width: 100%; /* Scale display width to container */
    height: auto; /* Maintain aspect ratio */
}

#start-screen {
    display: flex; /* Use flexbox for centering */
    flex-direction: column;
    max-width: 370px;
    align-items: center;
    justify-content: center;
    background-color: #e9e9e9;
    margin-top: 0px; /* Add some space from top */
    text-align: center; /* Center text within */
    font-family: inherit; /* Apply game font */
    border: 1px solid black;
    border-radius: 5px;
}

 h2 {
    font-family: inherit; /* Same font as game UI */
    color: #006400; /* Dark green */
    font-size: 2em;
    text-transform: uppercase; /* Optional: all caps look */
    letter-spacing: 2px; /* Optional: spacing between letters */
}

.options-group.layout-selection {
    width: auto; /* Allow layout selection to take more width */

}

.layout-selection label {
    max-width: 50%;
    margin: auto;
    margin-top: 5px;
}

#layout-previews {
    display: flex;
    gap: 15px; /* Space between previews */
    justify-content: flex-start; /* Align previews to the start */
    margin: 1px auto 0 auto; /* Center the container itself */
    overflow-x: auto; /* Enable horizontal scrolling */
    white-space: nowrap; /* Prevent previews from wrapping */
    padding-bottom: 15px; /* Increased padding for scrollbar visibility */
    max-width: 330px; /* Limit the container's max width */
    box-sizing: border-box; /* Include padding in width calculation */
    -webkit-overflow-scrolling: touch; /* Smoother scrolling on iOS */
    scrollbar-width: thin; /* Firefox scrollbar */
    scrollbar-color: rgba(0,0,0,0.2) rgba(0,0,0,0.1); /* Firefox scrollbar color */
}

/* Optional: Webkit scrollbar styling */
#layout-previews::-webkit-scrollbar {
    height: 8px;
}

#layout-previews::-webkit-scrollbar-track {
    background: rgba(0,0,0,0.1);
    border-radius: 4px;
}

#layout-previews::-webkit-scrollbar-thumb {
    background: rgba(0,0,0,0.3);
    border-radius: 4px;
}

#layout-previews::-webkit-scrollbar-thumb:hover {
    background: rgba(0,0,0,0.5);
}

/* Add the same scrollbar styling for all layout preview containers */
.layout-previews-container::-webkit-scrollbar {
    height: 8px;
}

.layout-previews-container::-webkit-scrollbar-track {
    background: rgba(0,0,0,0.1);
    border-radius: 4px;
}

.layout-previews-container::-webkit-scrollbar-thumb {
    background: rgba(0,0,0,0.3);
    border-radius: 4px;
}

.layout-previews-container::-webkit-scrollbar-thumb:hover {
    background: rgba(0,0,0,0.5);
}

.layout-preview {
    border: 2px solid transparent; /* Default border */
    padding: 0px;
    cursor: pointer;
    text-align: center;
    display: inline-block; /* Ensure items stay in line for scrolling */
    vertical-align: top; /* Align items nicely */
    flex-shrink: 0; /* Prevent flex items from shrinking */
    width: 120px; /* FIXED WIDTH for each preview */
    box-sizing: border-box; /* Include padding and border in width */
}

.layout-preview canvas {
    display: block;
    background-color: #ccc; /* BG for preview canvas */
    border: 1px solid #999;
}

.layout-preview p {
    margin: 5px 0 0 0;
    font-size: 0.9em;
}

.layout-preview.selected {
    /* border-color: #4CAF50; */ /* Highlight selected - OLD */
    border-color: var(--avatar-color, #4CAF50); /* Use avatar color with fallback */
    /* background-color: rgba(76, 175, 80, 0.1); */ /* REMOVED */
}

.options-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
}

.options-separator {
    display: flex;
    align-items: center; /* Vertically center the text */
    justify-content: center;
    font-style: italic;
    color: #666;
    margin: 0 10px; /* Space around the OR */
    align-self: flex-end; /* Align with bottom of inputs */
    padding-bottom: 5px; /* Fine-tune vertical alignment */
}

.options-group div { /* Style the radio button containers */
    margin-bottom: 0px;
}

.score-history-title{
    font-size: 13px;
}

.options-group input[type="number"] {
    width: 45px; /* Make number input smaller */
    padding: 2px;
}

.options-group input[type="color"] {
    width: 90px; /* Increased from 80px */
    height: 40px; /* Increased from 35px */
    padding: 2px; /* Minimal padding */
    border: 1px solid #ccc;
    cursor: pointer;
    vertical-align: middle; /* Align nicely with label if inline */
}

#startGameBtn {
    padding: 10px 20px;
    font-size: 1.1em;
    cursor: pointer;
    background-color: #4CAF50; /* Green */
    color: white;
    border: none;
    border-radius: 5px;
    font-family: inherit;
}

#game-area {
     /* Styles for the main game area container if needed */
     /* display: none; is handled inline in HTML initially */
     width: 100%; /* Ensure game area takes full width */
     display: flex; /* Use flex for centering its children */
     flex-direction: column;
     align-items: center;
}

/* Style for the Office Dash title */
#game-area h1 {
     font-family: inherit; /* Same font as game UI */
     color: #006400; /* Dark green instead of bright green */
     font-size: 2em;
     margin-bottom: 15px;
     text-transform: uppercase; /* Optional: all caps look */
     letter-spacing: 2px; /* Optional: spacing between letters */
}

#startButton {
    /* Remove or comment out styles for the old button if desired */
    /*
     margin-top: 15px;
     padding: 10px 20px;
     font-size: 1.1em;
     cursor: pointer;
    */
}

/* --- Game Over Screen NEW Styles --- */
#game-over-screen {
    display: none; /* Keep hidden initially */
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 100; /* Ensure it's on top */
    width: 90%; /* Responsive width */
    max-width: 380px; /* Max width */
    flex-direction: column;
    align-items: center;
    gap: 15px; /* Space between sections */
    background-color: rgba(255, 255, 255, 0.9); /* Semi-transparent white background */
    border-radius: 12px; /* Softer corners */
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2); /* Enhanced shadow for better visibility */
    text-align: center;
    font-family: inherit; /* Use Delius font */
    color: #333; /* Darker text color */
    border: 1px solid #ddd; /* Slightly darker border for contrast */
}

#game-over-screen h2 {
    margin: 0 0 10px 0; /* Adjust margin */
    font-size: 1.8em; /* Slightly smaller title */
    font-weight: 600; /* Slightly less bold */
    color: #333;
}

.score-details {
    display: flex;
    flex-direction: column;
    width: 100%;
    gap: 15px; /* Space between score items */
    padding-bottom: 0px; /* Space before buttons */
    border-bottom: 1px solid #eee; /* Separator line */
    margin-bottom: 10px;
}

.score-item {
    display: flex;
    justify-content: space-between; /* Label left, value right */
    align-items: baseline; /* Align text nicely */
    width: 100%;
}

.score-label {
    font-size: 1em;
    color: #555; /* Slightly lighter label color */
}

.score-value {
    font-size: 1.3em; /* Larger score value */
    font-weight: bold;
    color: #4CAF50; /* Use accent green */
}

#highestScoreDisplay.score-value {
    color: #666; /* Make highest score less prominent */
    font-size: 1.1em; /* Slightly smaller */
}

.game-over-actions {
    display: flex;
    flex-direction: row; /* Stack buttons vertically */
    width: 100%;
    gap: 12px; /* Space between buttons/link */
    align-items: center; /* Center buttons */
}

/* Ensure the old .game-over-buttons container is hidden */
.game-over-buttons {
    display: none !important;
}
/* Ensure the old .item-summary container is hidden */
.item-summary {
    display: none !important;
}

#goHomeBtn, #playAgainBtn, #shareImageBtn {
    padding: 12px 20px; /* Adjust padding */
    font-size: 1.1em;
    min-width: 100px; /* Match other buttons */
    font-weight: bold;
    cursor: pointer;
    color: white;
    border: none;
    margin-top:5px;
    border-radius: 8px; /* Consistent border-radius */
    font-family: inherit;
    transition: background-color 0.2s ease, transform 0.1s ease; /* Add transitions */
    /* Add flex properties for icon centering */
    display: flex;
    align-items: center;
    justify-content: center;
}

#goHomeBtn:hover, #playAgainBtn:hover, #shareImageBtn:hover {
    transform: translateY(-2px); /* Slight lift on hover */
}

#goHomeBtn {
    background-color: #555; /* Dark gray for home */
}
#goHomeBtn:hover {
    background-color: #444;
}

#playAgainBtn {
    background-color: #4CAF50; /* Accent green */
    box-shadow: 0 4px 10px rgba(76, 175, 80, 0.3); /* Add subtle shadow to primary button */
}
#playAgainBtn:hover {
    transform: scale(1.05); /* Slightly larger on hover */
}

/* Specific styles for the Share button */
#shareImageBtn {
    background-color: #E62117; /* Red background */
}

#shareImageBtn:hover {
    background-color: #c51b14; /* Darker red on hover */
    /* Optional: Add unique hover effect if desired */
    /* transform: scale(1.05); */
}

/* Style the leaderboard link like a button */
#leaderboardLink.leaderboard-link.btn-like {
    display: inline-block; /* Needed for padding/margin */
    background-color: #007bff; /* Blue background */
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1em;
    font-family: inherit;
    text-decoration: none; /* Remove underline */
    transition: background-color 0.2s ease, transform 0.1s ease;
    margin: 5px;
    min-width: 120px; /* Match other buttons */
}

#leaderboardLink.leaderboard-link.btn-like:hover {
    background-color: #0056b3; /* Darker blue on hover */
    transform: scale(1.05); /* Slightly larger on hover */
    text-decoration: none; /* Ensure no underline on hover */
}

#leaderboardLink.leaderboard-link {
    margin-top: 0px; /* Add space above link */
    font-size: 0.95em;
    color: #007bff; /* Blue link color */
    text-decoration: none;
    font-weight: 500;
    padding: 5px 10px;
    border-radius: 5px;
    transition: background-color 0.2s ease, color 0.2s ease;
}

#leaderboardLink.leaderboard-link:hover {
    color: #0056b3;
    background-color: rgba(0, 123, 255, 0.1); /* Subtle background on hover */
}

/* Reinstate #ui styles */
#ui {
    /* position: absolute; Removed */
    /* top: 0; Removed */
    /* left: 0; Removed */
    width: 100%; /* Span the width of the game-container */
    height: 20px;
    background-color: #222;
    color: #fff;
    font-family: inherit;
    border-bottom: 3px solid #444;
    padding: 5px 0px;
    border-radius: 0;
    display: flex;
    justify-content: space-between;
    flex-direction: row;
    align-content: space-around;
    align-items: center;
    flex-wrap: nowrap;
    /* z-index: 5; Removed */
}

/* Remove #ui styles */
/*
#ui {
// ... existing code ...
}
*/

/* Styles for score and timer now apply to the ones in top-bar */
#ui #score {
    padding-left: 15px; /* Adjust padding */
    font-size: 1.3em;
    font-weight: bold;
    color: #00ff00; /* Green score */
}

#ui #timer {
    padding-right: 15px; /* Adjust padding */
    font-size: 1.3em;
    font-weight: bold;
    color: #ff4444; /* Red timer */
}

#ui #message {
    font-size: 1.2em; /* Reset size */
    font-weight: bold;
    color: #ffcc00; /* Yellow for messages */
    text-align: center; /* Center message text */
    margin: 0 15px; /* Add horizontal margin to prevent sticking to edges */
}

/* Mobile Controls */
#mobile-controls {
    display: none; /* Hide on desktop by default */
    grid-template-columns: repeat(3, 60px);
    grid-template-rows: repeat(3, 60px); /* Changed to 3 rows */
    gap: 3px; /* Reduced from 5px */
    justify-content: center;
    margin-top: 15px;
    width: 100%;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

#mobile-controls button {
    font-size: 24px;
    font-weight: bold;
    /* Use gradient of player color shades */
    background: linear-gradient(135deg, var(--control-button-color, #555), var(--control-hover-color, #777));
    color: white;
    border: 2px solid #333;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    touch-action: manipulation; /* Prevent double-tap zoom */
    position: relative; /* For positioning pseudo-elements */
    overflow: hidden; /* Hide overflow for triangle shapes */
    transition: background 0.2s ease; /* Smooth transition */
}

#mobile-controls button:active {
    /* Invert the gradient when pressed */
    background: linear-gradient(315deg, var(--control-button-color, #555), var(--control-hover-color, #777));
}

/* Replace text arrows with triangle shapes */
#mobile-controls button::after {
    content: "";
    position: absolute;
    width: 0;
    height: 0;
    border-style: solid;
}

/* Up arrow */
#btn-up::after {
    border-width: 0 18px 24px 18px;
    border-color: transparent transparent var(--control-triangle-color) transparent;
}

/* Down arrow */
#btn-down::after {
    border-width: 24px 18px 0 18px;
    border-color: var(--control-triangle-color) transparent transparent transparent;
}

/* Left arrow */
#btn-left::after {
    border-width: 18px 24px 18px 0;
    border-color: transparent var(--control-triangle-color) transparent transparent;
}

/* Right arrow */
#btn-right::after {
    border-width: 18px 0 18px 24px;
    border-color: transparent transparent transparent var(--control-triangle-color);
}

/* Position buttons in grid - Changed to console-like layout */
#btn-up {
    grid-column: 2;
    grid-row: 1;
}

.duration-btn {
    padding: 8px 8px;
    font-size: 0.9em;
    cursor: pointer;
    color: #333;
    font-family: inherit;
    border: 1px solid #ccc;
    border-radius: 4px;
    margin: 2px;
    transition: background-color 0.2s ease, transform 0.1s ease;
}

.duration-btn:hover {
    transform: translateY(-1px);
}

#btn-left {
    grid-column: 1;
    grid-row: 2;
}

#btn-down {
    grid-column: 2; 
    grid-row: 3; /* Moved to third row */
}

#btn-right {
    grid-column: 3;
    grid-row: 2;
}

/* --- Media Queries for Mobile --- */
@media (max-width: 768px) {
    /* Smaller UI font on mobile */
    #ui #score,
    #ui #timer, #ui #layout-name-display{
        font-size: 0.8em; /* Further reduce font size */
        padding-left: 8px;
        padding-right: 8px;
    }

    .multiplayer-results{
        padding: 5px!important;
    }

    .player-score{
        padding: 0px!important;
    }

    #game-over-screen {
        top: 32%!important;
    }

    #ui #message {
        font-size: 0.75em; /* Further reduce message font size */
    }

    /* Larger mobile controls */
    #mobile-controls {
        display: grid; /* Show on mobile */
        grid-template-columns: repeat(3, 110px); /* Slightly smaller from 120px */
        grid-template-rows: repeat(3, 100px); /* Slightly smaller from 120px */
        gap: 5px; /* Reduced from 12px */
        margin-top: 10px; /* Reduced from 20px */
    }
    
    /* Create a tighter D-pad layout by adjusting specific button positions */
    #btn-up {
        margin-bottom: -15px; /* Pull up button down slightly */
    }
    
    #btn-down {
        margin-top: -15px; /* Pull down button up slightly */
    }
    
    #btn-left {
        margin-right: -15px; /* Pull left button right slightly */
    }
    
    #btn-right {
        margin-left: -15px; /* Pull right button left slightly */
    }

    #mobile-controls button {
        font-size: 50px; /* Much larger arrow icons - not used with triangles */
        border-width: 4px; /* Thicker border */
        border-radius: 15px; /* More rounded like console buttons */
        /* Use gradient with player color and its lighter shade */
        background: linear-gradient(135deg, var(--control-button-color, #555), var(--control-hover-color, #777));
        transition: background 0.2s ease; /* Add transition for mobile */
    }
    
    /* Larger triangles for mobile */
    #btn-up::after {
        border-width: 0 30px 40px 30px;
    }
    
    #btn-down::after {
        border-width: 40px 30px 0 30px;
    }
    
    #btn-left::after {
        border-width: 30px 40px 30px 0;
    }
    
    #btn-right::after {
        border-width: 30px 0 30px 40px;
    }

    #game-over-screen {
        width: 80%;
        gap: 10px;
    }
    #game-over-screen h2 {
        font-size: 1.6em;
    }
    .score-details {
        gap: 12px;
        padding-bottom: 0px;
    }
     .score-label {
        font-size: 0.9em;
    }
    .score-value {
        font-size: 1.1em;
    }
     #highestScoreDisplay.score-value {
        font-size: 1em;
    }
    .game-over-actions {
        gap: 10px;
    }
    #goHomeBtn, #playAgainBtn, #shareImageBtn {
        width: 90%;
        padding: 5px 5px;
        font-size: 1em;
        height: 50px;
    }
     #leaderboardLink.leaderboard-link {
        font-size: 0.9em;
     }
}

.score-popup {
    position: absolute;
    color: white;
    font-size: 20px;
    font-weight: bold;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    pointer-events: none;
    animation: scorePopup 1s ease-out forwards;
    z-index: 100;
}

@keyframes scorePopup {
    0% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    100% {
        opacity: 0;
        transform: translateY(-50px) scale(1.5);
    }
}

.score-history, .start-screen-score-history {
    margin-top: 20px;
    padding: 15px;
    background: rgba(0, 0, 0, 0.7);
    border-radius: 10px;
    color: white;
    width: 100%;
    max-width: 300px;
}

.install-btn {
    padding: 10px 20px;
    font-size: 1.1em;
    cursor: pointer;
    background-color: rgb(0, 123, 255);
    color: white;
    border: none;
    border-radius: 5px;
    font-family: inherit;
}

.final-score {
    font-size: 1.5rem;
    color: #006400;
    margin-top: 1rem;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
    font-weight: bold;
}

.highest-score {
    font-size: 1.2rem;
    font-weight: bold;
    color: #006400;
    margin-bottom: 2px;
}

.score-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.score-entry {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px 10px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 5px;
}

.score-entry .score {
    font-weight: bold;
    font-size: 18px;
}

.score-entry .date {
    font-size: 14px;
    color: #cccccc;
}

.start-screen-score-history {
    width: 95%; /* Limit width */
    max-width: 300px; /* Max width */
    margin: 20px auto; /* Center it */
    padding: 15px;
    background-color: rgba(255, 255, 255, 0.1); /* Subtle background */
    border-radius: 8px;
    border: 1px solid #000; /* Changed border to black */
    text-align: center;
}

.score-header {
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.score-subtitle {
    font-size: 0.8rem; /* Smaller subtitle */
    color: #555; /* Darker grey for subtitle */
}

.score-list {
    max-height: 150px; /* Limit height */
    overflow-y: auto; /* Add scroll if needed */
    padding-right: 5px; /* Space for scrollbar */
}

.score-entry {
    display: flex;
    justify-content: space-between; /* Space out rate and date */
    align-items: center;
    padding: 5px 0; /* Reduced padding */
    font-size: 13px;; /* Smaller font size for entries */
    border-bottom: 1px solid rgba(255, 255, 255, 0.1); /* Subtle separator */
}

.score-entry:last-child {
    border-bottom: none; /* Remove border for last item */
}

.score-rate {
    font-weight: bold;
    color: #333; /* Darker text for score rate */
}

.score-date {
    font-size: 0.8rem; /* Smaller date font */
    color: #666; /* Darker grey for date */
}

/* Scrollbar styling (optional, for better look) */
.score-list::-webkit-scrollbar {
    width: 5px;
}
 
.score-list::-webkit-scrollbar-track {
    background: rgba(0,0,0,0.1);
    border-radius: 10px;
}
 
.score-list::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.3);
    border-radius: 10px;
}

.score-list::-webkit-scrollbar-thumb:hover {
    background: rgba(255,255,255,0.5); 
}

.inline-options-group {
    display: flex;
    justify-content: center; /* Center the items within */
    align-items: flex-end; /* Align items to their bottom edge */
    gap: 10px; /* Add space between the boss and duration groups */
    width: 100%; /* Take full width to allow centering */
}

/* Adjust width of individual groups inside the inline wrapper */
.inline-options-group .options-group {
    width: auto; /* Allow them to shrink to content size */
    margin-bottom: 0; /* Remove bottom margin as it's handled by the wrapper */
    text-align: center; /* Center text/label within each group */
}

.inline-options-group .options-group label {
    display: block; /* Ensure label is above input */
}

.inline-options-group .options-group input[type="number"] {
    width: 60px; /* Slightly wider input */
}

/* Style for option groups that should take full width */
.options-group-full-width {
    text-align: center;
}

.options-group-full-width label {
    display: block; /* Label on top */
    margin-bottom: 5px;
}

/* Style file input labels as buttons and hide the default input */
input[type="file"] {
    width: 0.1px;
    height: 0.1px;
    opacity: 0;
    overflow: hidden;
    position: absolute;
    z-index: -1;
}

input[type="file"] + label {
    display: inline-block; /* Or block if preferred */
    padding: 8px 15px;
    font-size: 0.9em;
    font-weight: bold;
    color: white;
    background-color: #4CAF50; /* Change to match Start Game button green */
    border: none;
    border-radius: 5px; /* Match Start Game button border-radius */
    cursor: pointer;
    transition: background-color 0.2s ease;
    vertical-align: middle; /* Align with other elements if inline */
}

input[type="file"]:focus + label,
input[type="file"] + label:hover {
    background-color: #45a049; /* Darker green on hover/focus */
}

/* Adjust spacing if the preview image is present */
input[type="file"] + label > img.avatar-input-preview,
input[type="file"] + label > img.boss-input-preview {
    margin-left: 8px;
    margin-right: -5px; /* Pull image slightly closer to text */
}


.avatar-boss {
    margin-top: 15px;
}
/* Crop Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    overflow: auto;
}

.modal-content {
    background-color: #2a2a2a;
    margin: 5% auto;
    padding: 20px;
    border: 1px solid #555;
    border-radius: 8px;
    width: 80%;
    max-width: 600px;
    color: #fff;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
}

.close-btn {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close-btn:hover {
    color: #fff;
}

.crop-container {
    margin: 20px auto;
    max-width: 500px;
    max-height: 400px;
    background-color: #000;
}

#imageToCrop {
    display: block;
    max-width: 100%;
}

.crop-controls {
    margin-top: 20px;
    display: flex;
    justify-content: center;
    gap: 15px;
}

.crop-btn {
    padding: 8px 20px;
    background-color: #4CAF50;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    transition: background-color 0.2s;
}

.crop-btn:hover {
    background-color: #45a049;
}

#cancelCropBtn {
    background-color: #f44336;
}

#cancelCropBtn:hover {
    background-color: #d32f2f;
}

/* Ensure cropper.js elements display correctly in dark mode */
.cropper-container {
    direction: ltr;
    font-size: 0;
    line-height: 0;
    position: relative;
    touch-action: none;
    user-select: none;
}

.cropper-container img {
    display: block;
    height: 100%;
    image-orientation: 0deg;
    max-height: none !important;
    max-width: none !important;
    min-height: 0 !important;
    min-width: 0 !important;
    width: 100%;
}

/* Boss History Preview Styles */
.boss-history-container {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap; /* Allow wrapping if many faces */
    max-width: 90%; /* Match layout preview width */
    margin-left: auto;
    margin-right: auto;
}

.boss-history-preview-container { /* New container style */
    position: relative; /* For absolute positioning of delete button */
    display: inline-block; /* Keep items inline */
}

.boss-history-preview {
    width: 45px;
    height: 45px;
    border-radius: 50%; /* Circular previews */
    border: 2px solid #666;
    object-fit: cover; /* Ensure image covers the area */
    cursor: pointer;
    margin-top: 15px;
    transition: transform 0.2s, border-color 0.2s;
}

.face-delete-btn { /* New delete button style */
    position: absolute;
    top: -5px; /* Position slightly above top right */
    right: -5px;
    width: 18px;
    height: 18px;
    background-color: rgba(255, 0, 0, 0.7); /* Semi-transparent red */
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.8);
    border-radius: 50%;
    font-size: 12px;
    font-weight: bold;
    line-height: 16px; /* Center the 'X' */
    text-align: center;
    cursor: pointer;
    opacity: 0; /* Hidden by default */
    transition: opacity 0.2s ease-in-out;
    z-index: 1; /* Ensure it's above the image */
}

.boss-history-preview-container:hover .face-delete-btn { /* Show on hover */
    opacity: 1;
}

.main-avatar {    
    border: 1px solid grey;
    padding: 10px;
    width: 360px;
    margin-right: auto;
}

.main-boss {    
    padding: 10px;
    width: 360px;
}
/* Avatar History Preview Styles (similar to boss) */
.avatar-history-container {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 10px;
    max-width: 90%;
    margin-left: auto;
    margin-right: auto;
}

.avatar-history-preview-container { /* New container style */
    position: relative;
    display: inline-block;
}

.avatar-history-preview {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    border: 2px solid #666;
    object-fit: cover;
    cursor: pointer;
    transition: transform 0.2s, border-color 0.2s;
}

.avatar-history-preview:hover {
    transform: scale(1.1);
    border-color: #fff;
}

/* Use the same face-delete-btn style for avatars */
.avatar-history-preview-container:hover .face-delete-btn {
    opacity: 1;
}

/* Style for the Leaderboard Link Button */
.leaderboard-link-button {
    display: inline-block; /* Allow margin auto to center */
    padding: 8px 18px;
    margin-top: 15px; /* Space above the button */
    margin-bottom: 10px; /* Space below the button */
    font-size: 0.9em;
    font-weight: bold;
    color: white;
    background-color: #007bff; /* Blue color */
    border: none;
    border-radius: 5px;
    text-decoration: none; /* Remove underline from link */
    cursor: pointer;
    transition: background-color 0.2s ease;
    text-align: center;
    font-family: inherit /* Match game font */
}

.leaderboard-link-button:hover {
    background-color: #0056b3; /* Darker blue on hover */
    color: white; /* Keep text white on hover */
}

a.back-link:hover {
    background-color: #3e8e41;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

/* Start Game Button Container Specific Styling */
.start-game-button-container {
    /* Add any default styles here if needed */
    /* Example: margin-top: 20px; */
}

/* Desktop Specific Styles */
@media (min-width: 769px) { 
    .start-game-button-container {
        position: initial!important;
    }
}

/* NEW: Share Button Styles */
.share-btn {
    display: inline-block;
    padding: 8px 15px; /* Slightly smaller padding */
    color: white;
    text-decoration: none;
    font-weight: bold;
    border-radius: 5px;
    transition: background-color 0.3s, box-shadow 0.3s;
    box-shadow: 0 2px 5px rgba(0,0,0,0.15);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 0.8em; /* Slightly smaller font */
    border:0px;
    text-align: center;
    font-family: inherit;
    background-color: var(--share-button-bg-color); /* Use variable */
}

.share-btn:hover {
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    background-color: var(--share-button-hover-color); /* Use variable */
}

.whatsapp-btn {
    /* background-color: #25D366; */ /* WhatsApp Green - REMOVED */
    /* Use the variable now, specific overrides removed */
}
/* .whatsapp-btn:hover {
    background-color: #1DA851; 
} */ /* REMOVED hover override */

.message-btn {
    /* background-color: #007bff; */ /* Standard Blue - REMOVED */
    /* Use the variable now, specific overrides removed */
}
/* .message-btn:hover {
    background-color: #0056b3;
} */ /* REMOVED hover override */
/* END NEW */

.leaderboard-container {
    max-width: 330px;
    width: 90%;
    margin: 0 auto;
    /* background: #ffffff; */ /* REMOVED fixed white background */
    border: 2px solid #dbe2ec;
    border-radius: 0;
    box-shadow: none;
    overflow: hidden;
}

/* NEW: Authentication Modal Styles */
#authModal {
    /* Uses existing .modal styles for background/positioning */
}

#authModal .modal-content {
    background-color: #e9e9e9; /* Match start screen background */
    color: #333; /* Dark text for contrast */
    border: 1px solid #ccc; /* Softer border */
    border-radius: 10px; /* Consistent rounded corners */
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2); /* Subtle shadow */
    font-family: 'Delius', cursive; /* Ensure correct font */
    padding: 25px; /* More internal spacing */
    max-width: 330px;
}

#authModal h3 {
    color: #4CAF50; /* Theme green */
    margin-bottom: 20px;
    font-size: 1.6em;
    text-align: center;
}

#authModal .options-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
    color: #555; /* Slightly muted label color */
    text-align: left;
}

#authModal .options-group input[type="text"],
#authModal .options-group input[type="password"] {
    width: 100%;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 5px;
    font-family: 'Delius', cursive;
    font-size: 1em;
    margin-bottom: 15px; /* Ensure space below input */
}

#authModal button[type="submit"] {
    /* Uses .share-btn base styles */
    width: 100%;
    padding: 12px;
    font-size: 1.1em;
    margin-top: 10px; /* Space above button */
}

#authModal p {
    text-align: center;
    margin-top: 15px;
    font-size: 0.9em;
    color: #666;
}

#authModal p a {
    color: #007bff; /* Theme blue for links */
    font-weight: bold;
    text-decoration: none;
}

#authModal p a:hover {
    text-decoration: underline;
}

#authModal #authError {
    color: #dc3545; /* Bootstrap danger red */
    font-weight: bold;
    margin-top: 15px;
    font-size: 0.9em;
}

#authModal .close-btn {
    /* Reuse existing close button style or enhance */
    color: #aaa;
    position: absolute; /* Position relative to modal-content */
    top: 10px;
    right: 15px;
    font-size: 28px;
    font-weight: bold;
    line-height: 1;
    cursor: pointer;
}

#authModal .close-btn:hover {
    color: #555; /* Darker hover */
}
/* END NEW: Authentication Modal Styles */

/* NEW: Notification Popup Styles */
.notification-popup {
    position: fixed;
    top: -100px; /* Start off-screen */
    left: 50%;
    transform: translateX(-50%);
    background-color: #4CAF50; /* Default success background */
    color: white;
    padding: 12px 25px;
    border-radius: 0 0 8px 8px; /* Rounded bottom corners */
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    z-index: 2000; /* Ensure it's above everything else */
    font-family: 'Delius', cursive;
    font-size: 1.1em;
    font-weight: bold;
    text-align: center;
    opacity: 0;
    transition: top 0.5s ease-in-out, opacity 0.5s ease-in-out;
}

.notification-popup.show {
    top: 0; /* Slide down */
    opacity: 1;
}

.notification-popup.error {
    background-color: #dc3545; /* Red for errors */
}
/* END NEW: Notification Popup Styles */

/* NEW: Player Name Display Styles */
#playerNameInput,
#playerNameInput2 {
    border: none;
    background-color: transparent;
    outline: none;
    padding: 2px; /* Minimal padding to align */
    margin: 0; /* Reset margin */
    font-weight: bold; /* Make it look like part of the content */
    color: #333; /* Match other text color */
    cursor: default; /* Don't show text input cursor */
    width: auto; /* Allow it to size based on content */
    text-align: center; /* Align with label if needed */
    box-shadow: none; /* Remove any potential shadow */
}

/* Remove focus outline if any browser applies it */
#playerNameInput:focus,
#playerNameInput2:focus {
    outline: none;
    box-shadow: none;
}
/* END NEW: Player Name Display Styles */

/* NEW: Info Icon Styles */
.info-icon {
    color: #6c757d; /* Bootstrap secondary grey */
    font-size: 1em; /* Adjust size as needed */
    vertical-align: middle; /* Align with text/input */
    cursor: help; /* Indicate it provides info */
    transition: color 0.2s ease;
}

.info-icon:hover {
    color: #007bff; /* Blue on hover */
}
/* END NEW: Info Icon Styles */

/* NEW: Verified User Pulse Animation */
@keyframes color-pulse {
    0%   { color: #333; text-shadow: 0 0 1px rgba(0, 123, 255, 0.3); }
    50%  { color: #007bff; text-shadow: 0 0 4px rgba(0, 123, 255, 0.7); }
    100% { color: #333; text-shadow: 0 0 1px rgba(0, 123, 255, 0.3); }
}

.verified-username-pulse {
    font-weight: 600; /* Slightly bolder */
    animation: color-pulse 2.5s infinite ease-in-out; /* Apply the pulse animation */
}
/* END NEW: Verified User Pulse Animation */
