:root {
    --primary: #6d5dfc;
    --primary-light: #8677f9;
    --primary-dark: #5346da;
    --secondary: #fc5d8d;
    --secondary-light: #ff7aa2;
    --secondary-dark: #e63d71;
    --accent: #37cdbe;
    --bg-dark: #151c2c;
    --bg-medium: #1f2937;
    --bg-light: #2c3645;
    --text-light: #f1f5f9;
    --text-muted: #94a3b8;
    --border-radius: 25px;
    --spacing-xs: 4px;
    --spacing-sm: 8px;
    --spacing-md: 16px;
    --spacing-lg: 24px;
    --transition: all 0.3s ease;
    --notify-system-notify: linear-gradient(to right, var(--primary), var(--secondary)) !important;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Outfit', sans-serif;
    font-weight: 200;
}


body {
    margin: 0;
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
    background-color: var(--bg-dark);
    color: var(--text-light);
    touch-action: none;
}

header {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: var(--spacing-sm) 0px;
    background-color: var(--bg-medium);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    z-index: 110;
    gap: 0px 10px; 
}

header {
    display: flex;
    flex-direction: column;
    align-items: center;
  }
  
  .logo {
    margin-bottom: 0.5rem;
  }
  
  .header-buttons {
    display: flex;
    gap: 0.25rem; /* spacing between buttons */
    justify-content: center;
    flex-wrap: wrap; /* allows wrapping on smaller screens */
  }

.credits {
    font-family: 'Playwrite IT Moderna', serif;
    text-decoration: none;
    /* Removes underline */
}

.logo {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    font-weight: bold;
    font-size: 1.2rem;
}

.logo i {
    color: var(--primary);
}

.logo-text {
    background: linear-gradient(to right, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}


.credits-display {
    display: flex;
    align-items: center;
    background: linear-gradient(135deg, #209ce9, #b80bfb);
    padding: var(--spacing-xs) var(--spacing-xs);
    border-radius: var(--border-radius);
    font-weight: 600;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    align-items: center;
    min-width: 85px;
    user-select: none;
    /* Disable text selection */
    -webkit-tap-highlight-color: transparent;

}

.credits-icon {
    margin-right: var(--spacing-xs);
    margin-left: var(--spacing-xs);
    color: #fff;
}

.free-pixels-display {
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-xs) var(--spacing-xs);
    border-radius: 999px;
    font-weight: 600;
    color: white;
    background: transparent;
    min-width: 85px;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    filter: drop-shadow(0 0 5px rgba(32, 156, 233, 0.5)); 
    border: 1px solid #2851f6;
}

.free-pixels-display::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 300%;
    height: 100%;
    background: url("nav-bg-fill.png") repeat-x;
    background-size: 150px 75px; /* Half original size */
    background-position: 0 0%;
    animation: waveFill 8s linear infinite;
    z-index: -1;
}

@keyframes waveFill {
    0% {
        transform: translateX(0);
    }
    100% {
        transform: translateX(-150px); /* Match tile width */
    }
}



.free-pixels-icon {
    margin-right: var(--spacing-xs);
    margin-left: var(--spacing-xs);
    color: #fff;
}

/* Color picker override */
.pcr-app .pcr-interaction .pcr-save {
    background: #6d5dfc;
    border-radius: 25px;
    height: 40px;
    padding: 10px;
    width: 100px;
}
.pcr-app .pcr-interaction .pcr-save:hover {
    background-color: var(--primary-light);
    transform: translateY(-2px);
}

.color-picker[data-picker-role="background"] {
    position: relative;
    background-color: transparent;
}
.color-picker[data-picker-role="background"]::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--checker-bg, #333333); /* Fallback to #FFCC00 */
    background-image: 
        linear-gradient(45deg, rgba(0, 0, 0, 0.3) 25%, transparent 25%, transparent 75%, rgba(0, 0, 0, 0.3) 75%),
        linear-gradient(45deg, rgba(0, 0, 0, 0.3) 25%, transparent 25%, transparent 75%, rgba(0, 0, 0, 0.3) 75%);
    background-size: 8px 8px;
    background-position: 0 0, 4px 4px;
    border-radius: 50%;
    z-index: 0;
}
.color-picker[data-picker-role="background"] .pcr-button {
    background-color: transparent !important;
    border-color: #00000075 !important;
    position: relative;
    z-index: 1;
}
.color-picker.active-picker[data-picker-role="background"] {
    border-color: #00000075 !important;
}

.loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1;
}

.loader p {
    font-family: 'Playwrite IT Moderna', serif;
    font-size: 4em;
    background: linear-gradient(to right, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.completion-percentage {
    display: flex;
    align-items: center;
    background: linear-gradient(135deg, #209ce9, #b80bfb);
    padding: var(--spacing-xs) var(--spacing-xs);
    border-radius: var(--border-radius);
    font-weight: 600;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    justify-content: center;
    align-items: center;
    min-width: 85px;
    user-select: none;
    /* Disable text selection */
    -webkit-tap-highlight-color: transparent;

}

.live-view-counter {
    display: flex;
    align-items: center;
    background: linear-gradient(135deg, #209ce9, #b80bfb);
    padding: var(--spacing-xs) var(--spacing-xs);
    border-radius: var(--border-radius);
    font-weight: 600;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    justify-content: center;
    align-items: center;
    min-width: 85px;
    user-select: none;
    /* Disable text selection */
    -webkit-tap-highlight-color: transparent;
    white-space: nowrap;
}

#view-count-text {
    white-space: nowrap;
    flex-shrink: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%; /* important in case flex container wants to limit width */
}

.completion-icon {
    margin-right: var(--spacing-xs);
    margin-left: var(--spacing-xs);
    color: #fff;
}


.hamburger.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
  }
  
  .hamburger.active span:nth-child(2) {
    opacity: 0;
  }
  
  .hamburger.active span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
  }

#canvas-container {
    flex: 1;
    position: relative;
    width: 100%;
    overflow: hidden;
    cursor: default;
    display: flex;
    justify-content: center;
    align-items: center;
}

.canvas-wrapper {
    box-shadow: 0 0 30px rgba(109, 93, 252, 0.2);
}

.canvas-border {
    position: absolute;
    border: 1px solid var(--primary-light);
    pointer-events: none;
    z-index: 3;
}

canvas {
    position: absolute;
    left: 0;
    top: 0;
    image-rendering: -moz-crisp-edges;
    image-rendering: -webkit-crisp-edges;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}

#canvas {
    z-index: 1;
}

/* --- Add this to your css/styles.css --- */

#canvas,
#preview {
    /* Standard property */
    image-rendering: pixelated;

    /* Older Firefox */
    image-rendering: -moz-crisp-edges;

    /* Older Webkit (Chrome, Safari) and standard fallback */
    image-rendering: crisp-edges;

    /* Ensure canvas background doesn't interfere if needed, 
       though your checkerboard likely handles this */
    background-color: transparent;

    /* Important: Prevents the browser from creating a default compositing layer 
       which can sometimes interfere with pixelated rendering */
    will-change: transform;
}

/* Optional: Ensure the container doesn't force blurring */
#canvas-container,
.canvas-wrapper {
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
}

/* --- End of addition --- */


#preview {
    z-index: 2;
    background: transparent;
}

.status-indicators {
    position: absolute;
    top: var(--spacing-md);
    left: var(--spacing-md);
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
    z-index: 10;
}


.indicator {
    background-color: rgba(31, 41, 55, 0.85);
    color: var(--text-light);
    padding: var(--spacing-xs) var(--spacing-sm);
    border-radius: var(--border-radius);
    backdrop-filter: blur(4px);
    font-size: 0.85rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);

    user-select: none;
    pointer-events: none;
    cursor: default;
}

#zoom-indicator {
    position: absolute;
    top: var(--spacing-md);
    right: var(--spacing-md);
    background-color: rgba(31, 41, 55, 0.85);
    color: var(--text-light);
    padding: var(--spacing-xs) var(--spacing-sm);
    border-radius: var(--border-radius);
    backdrop-filter: blur(4px);
    font-size: 0.85rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    z-index: 10;
    border: 1px solid var(--bg-light);
    user-select: none;
    pointer-events: none;
    cursor: default;
}

#controls {
    padding: var(--spacing-sm);
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    justify-content: space-between;
    align-items: center;
    background-color: var(--bg-medium);
    border-top: 1px solid var(--bg-light);
    position: sticky;
    bottom: 0;
    width: 100%;
    gap: var(--spacing-sm);
    height: auto;
    min-height: 70px;

    z-index: 100;
}

.control-group {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
}

button,
a,
#completion-button,
.credits-display {
    -webkit-tap-highlight-color: transparent;
}

a,
a:visited,
a:hover {
    color: var(--primary);
    text-decoration: none;
}

.notify-system-notification {
    height: 57px !important;
}


button {
    user-select: none;
    -webkit-user-select: none;
    /* Safari */
    -ms-user-select: none;
    /* IE/Edge */
}

.xno-button {
    background-color: var(--primary) !important;
    color: white !important;
    padding: 25px !important;
    border-radius: 25px !important;
}

h2#modalTitle {
    font-family: 'Playwrite IT Moderna', serif;
    background: linear-gradient(to right, var(--primary), var(--secondary));
    background-clip: text;
    color: transparent;
}


.xno-paywall-content {
    border-radius: 25px !important;
}

button {
    background-color: var(--bg-light);
    color: var(--text-light);
    border: none;
    border-radius: var(--border-radius);
    padding: var(--spacing-xs) var(--spacing-sm);
    font-size: 0.9rem;
    cursor: pointer;
    transition: var(--transition);
    height: 40px;
    white-space: nowrap;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-xs);
}

button:hover {
    transform: translateY(-2px);
}

button:active,
button.active {
    background-color: var(--primary);
    transform: translateY(0);
}



.btn-primary {
    background-color: var(--primary);
    color: white;
    padding: 25px;
}




.btn-primary:hover {
    background-color: var(--primary-light);
}

.btn-secondary {
    background-color: var(--secondary);
    color: white;
}

.btn-secondary:hover {
    background-color: var(--secondary-light);
}


/* Container for all color pickers */
.color-pickers {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-sm, 10px);
    /* Use your spacing variable or fallback */
    justify-content: center;
    align-items: center;
}

/* Individual color picker */
.color-picker {
    width: 40px;
    height: 40px;
    border: 3px solid var(--bg-light, #e0e0e0);
    /* Fallback to a light gray */
    border-radius: 50%;
    overflow: hidden;
    cursor: pointer;
    background-color: #209ce9;
    /* Default fallback color */
    transition: var(--transition, transform 0.2s ease, box-shadow 0.2s ease);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

/* Hover effect */
.color-picker:hover {
    transform: scale(1.1);
}

/* Active picker highlight */
.color-picker.active-picker {
    border-color: var(--text-light, #ffffff);
    /* Use text-light or fallback to white */
    box-shadow: 0 0 5px rgba(0, 0, 0, 0.5);
}

/* Style the Pickr button inside each picker */
.color-picker .pcr-button {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    /* Match the circular shape */
    background-size: cover;
}

/* Ensure Pickr popup is visible */
.pickr {
    z-index: 1000;
}

/* Style the Pickr app popup */
.pcr-app {
    font-family: 'Poppins', sans-serif;
    border-radius: var(--border-radius, 4px);
    z-index: 1001;
    /* Ensure popup is above other elements */
}

/* Existing input styles (unchanged) */
input[type="text"] {
    padding: var(--spacing-sm);
    border-radius: var(--border-radius);
    border: 1px solid var(--bg-light);
    background-color: var(--bg-light);
    color: var(--text-light);
    height: 40px;
    font-size: 0.9rem;
}

/* Remove old #colorPicker styles to avoid confusion */
#colorPicker {
    display: none;
    /* Hide if it exists from old code */
}



.paywall-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    background: rgba(255, 255, 255, 0.1) !important;
    backdrop-filter: blur(5px);
}

.paywall-content {
    position: relative;
    overflow: auto;
    max-height: 90%;
    max-width: 90%;
    border-radius: var(--border-radius);
    box-shadow: 0 10px 10px rgba(0, 0, 0, 0.3);
}

.paywall-close {
    position: absolute;
    top: 0;
    right: 0;
    font-size: 24px;
    color: white;
    cursor: pointer;
    user-select: none;
    height: 100%;
    width: 100%;
}


.modal {
    background: rgba(255, 255, 255, 0.1) !important;
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    display: none;
} 

input#userID {
    display: none;
}

.touch-controls {
    display: flex;
    gap: var(--spacing-xs);
}

button#zoomInBtn,
button#zoomOutBtn,
button#panBtn {
    display: none;
}

.toolbar {
    position: absolute;
    left: var(--spacing-md);
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
    background-color: rgba(31, 41, 55, 0.85);
    backdrop-filter: blur(4px);
    padding: var(--spacing-sm);
    border-radius: var(--border-radius);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    border: 1px solid var(--bg-light);
    z-index: 10;
}

.toolbar button {
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: 50%;
    transition: var(--transition);
}

.toolbar button.active {
    background-color: var(--primary);
    color: white;
}

.toolbar-separator {
    height: 1px;
    background-color: var(--bg-light);
    margin: var(--spacing-xs) 0;
}

/* Tool tooltips */
.toolbar button {
    position: relative;
}

.toolbar button::after {
    content: attr(data-tooltip);
    position: absolute;
    left: 48px;
    top: 50%;
    transform: translateY(-50%);
    background-color: var(--bg-dark);
    color: var(--text-light);
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
    white-space: nowrap;
}

.toolbar button:hover::after {
    opacity: 1;
}

header button {
    all: unset;
    /* Removes all inherited styles */
    background: none;
    /* No background */
    border: none;
    /* No border */
    padding: 0;
    /* No padding */
    font: inherit;
    /* Inherit the font from the parent */
    cursor: pointer;
    /* Ensure the pointer cursor is displayed */
    transition: var(--transition);
}

header button:focus,
header button:active {
    background: none;
    /* Explicitly remove background */
    outline: none;
    /* Remove outline on focus */
}

.pixel-info {
    position: absolute;
    bottom: calc(2rem + env(safe-area-inset-bottom, 0px));
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(31, 41, 55, 0.85);
    color: var(--text-light);
    padding: var(--spacing-xs) var(--spacing-sm);
    border-radius: var(--border-radius);
    backdrop-filter: blur(4px);
    font-size: 0.85rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    border: 1px solid var(--bg-light);
    z-index: 10;

    user-select: none;
    pointer-events: auto;
    cursor: default;
}

.toolbar {
    z-index: 20;
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.modal-content {
    border-radius: 25px !important;
    width: 90% !important;
}




/* Animation for new pixels */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

.pixel-animation {
    animation: fadeIn 0.3s ease-out;
}

/* Responsive adjustments */
@media (max-width: 768px) {


    .toolbar {
        position: fixed;
        left: 50%;
        bottom: 90px;
        /* 20px + safe area */
        transform: translateX(-50%);
        flex-direction: row;
    }

    .toolbar button::after {
        left: 50%;
        top: -30px;
        transform: translateX(-50%);
    }

    .toolbar-separator {
        height: auto;
        width: 1px;
        margin: 0 var(--spacing-xs);
    }

    #controls {
        justify-content: center;
        padding: var(--spacing-xs);
    }

    button {
        padding: var(--spacing-xs) var(--spacing-xs);
        font-size: 0.8rem;
        height: 36px;
    }

    .status-indicators {
        top: var(--spacing-sm);
        left: var(--spacing-sm);
    }

    #zoom-indicator {
        top: var(--spacing-sm);
        right: var(--spacing-sm);
    }

    .pixel-info {
        bottom: 160px;
        position: fixed;
    }
}