/* Add these font imports at the top */
@font-face {
    font-family: 'Panton';
    src: url('fonts/Panton-Regular.woff2') format('woff2'),
        url('fonts/Panton-Regular.woff') format('woff');
    font-weight: normal;
    font-style: normal;
}

@font-face {
    font-family: 'Panton';
    src: url('fonts/Panton-Bold.woff2') format('woff2'),
        url('fonts/Panton-Bold.woff') format('woff');
    font-weight: bold;
    font-style: normal;
}

body {
    /* Update the font-family */
    font-family: 'Panton', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-image: url('images/background.webp');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    padding: 20px;
    user-select: none;
    background-color: #2a2a2a;
    /* Dark background to match pixel art theme */
    color: #cfcfcf;
    /* Light gray text for better readability */
}

/* Make sure other elements inherit the font */
button,
input,
select,
textarea {
    font-family: inherit;
}

.header {
    text-align: center;
    margin: 20px 0;
}

.header h1 {
    color: #ffffff;
    font-size: 2.5em;
    margin-bottom: 5px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.header p {
    color: #ffffff;
    /* Change from #cfcfcf to white */
    font-size: 1.2em;
    margin-top: 0;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8),
        /* Stronger shadow */
        0 0 10px rgba(0, 0, 0, 0.5);
    /* Additional glow shadow for better contrast */
}

/* Remove this block entirely */
/*
.logo {
    width: 64px;
    height: 64px;
    margin-bottom: 10px;
    pointer-events: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-user-drag: none;
}
*/

.toolbar {
    display: flex;
    gap: 10px;
}

.toolbar button {
    padding: 5px 10px;
    cursor: pointer;
    background-color: rgba(58, 58, 58, 0.85);
    color: #e0e0e0;
    border: 1px solid rgba(90, 90, 90, 0.8);
    border-radius: 2px;
    backdrop-filter: blur(3px);
    transition: background-color 0.2s;
}

.toolbar button.active {
    background-color: #6a6a6a;
    /* Highlight active button with medium gray */
    color: #ffffff;
}

.toolbar button:hover {
    background-color: #4a4a4a;
    /* Hover effect with lighter gray */
}

/* Remove general dropdown cursor style */
.toolbar .dropdown button {
    cursor: pointer;
}

#grid-container {
    position: relative;
    width: 370px;
    height: 370px;
}

#grid {
    display: grid;
    grid-template-columns: repeat(37, 10px);
    grid-template-rows: repeat(37, 10px);
    gap: 0;
    border: 1px solid rgba(90, 90, 90, 0.8);
    /* Border matching pixel art style */
    background-color: rgba(58, 58, 58, 0.85);
    backdrop-filter: blur(3px);
}

.cell {
    width: 10px;
    height: 10px;
    border: 1px solid rgba(74, 74, 74, 0.8);
    /* Slightly lighter border for cell separation */
    background-color: rgba(42, 42, 42, 0.85);
    /* Dark cell background */
    position: relative;
    /* Add this for the center dot */
    transition: background-color 0.15s ease-out;
}

.cell.center::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 4px;
    height: 4px;
    background-color: #666;
    border-radius: 50%;
    pointer-events: none;
}

.cell.filled {
    background-color: rgba(255, 255, 255, 0.95);
    /* White filled cells to match pixel design */
    animation: fillCell 0.15s ease-out;
}

.cell.filled.center::after {
    background-color: #444;
}

.cell.unfilled {
    animation: unfillCell 0.15s ease-out;
}

/* Add undo animation class */
.cell.undo {
    animation: undoCell 0.2s ease-out;
}

#previewLayer {
    position: absolute;
    top: 0;
    left: 0;
    pointer-events: none;
    z-index: 1;
    /* Remove filter: invert(1) and use opacity instead */
    opacity: 0.4;
}

.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-content {
    display: none;
    position: absolute;
    background-color: rgba(58, 58, 58, 0.85);
    min-width: 160px;
    box-shadow: 0px 8px 16px 0px rgba(0, 0, 0, 0.3);
    z-index: 2;
    border: 1px solid rgba(90, 90, 90, 0.8);
    backdrop-filter: blur(3px);
    overscroll-behavior: contain;
}

.dropdown-content button {
    display: block;
    width: 100%;
    text-align: left;
    background: none;
    border: none;
    padding: 8px 16px;
    color: #cfcfcf;
}

.dropdown-content button:hover {
    background-color: #4a4a4a;
}

/* Display dropdown on hover or via JavaScript */
.dropdown-content.show {
    display: block;
}

.dropdown-content button.active {
    background-color: #4a4a4a;
    color: #ffffff;
}

#fill-toggle.active {
    background-color: #6a6a6a;
    color: white;
}

/* Update fill toggle styles to ensure it's clickable */
#fill-toggle {
    position: relative;
    z-index: 2;
    pointer-events: auto;
}

.encoded-state {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 20px;
    width: 100%;
    max-width: 500px;
}

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

.copy-options {
    display: flex;
    align-items: center;
    gap: 10px;
}

.embed-toggle {
    display: flex;
    align-items: center;
    gap: 5px;
    color: #cfcfcf;
    font-size: 14px;
    cursor: pointer;
}

.embed-toggle input[type="checkbox"] {
    cursor: pointer;
    width: 16px;
    height: 16px;
    accent-color: #4a4a4a;
}

#encoded-crosshair {
    width: 100%;
    padding: 8px;
    background-color: rgba(58, 58, 58, 0.85);
    color: #e0e0e0;
    border: 1px solid rgba(90, 90, 90, 0.8);
    backdrop-filter: blur(3px);
}

#copy-crosshair {
    padding: 8px 16px;
    cursor: pointer;
    background-color: #3a3a3a;
    color: #e0e0e0;
    border: 1px solid #5a5a5a;
}

#copy-crosshair:hover {
    background-color: #4a4a4a;
}

.presets-content {
    max-height: 400px;
    overflow-y: auto;
}

.presets-content button {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: 8px 16px;
    border: none;
    background: none;
    color: #cfcfcf;
    cursor: pointer;
    text-align: left;
}

.presets-content button:hover {
    background-color: #4a4a4a;
}

.preset-name {
    margin-right: 10px;
}

/* Add specific cursor style for presets dropdown */
#presets-dropdown {
    cursor: ns-resize;
}

/* Add cursor style for tools dropdown */
#shapes-dropdown {
    cursor: ns-resize;
}

/* Add tooltip styles */
[data-tooltip] {
    position: relative;
}

[data-tooltip]:before {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    padding: 5px 10px;
    background: #333;
    color: white;
    border-radius: 4px;
    font-size: 14px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s;
}

[data-tooltip]:hover:before {
    opacity: 1;
    visibility: visible;
    transition-delay: 0.3s;
}

/* Help button styles */
#help-button {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: #3a3a3a;
    border: 1px solid #5a5a5a;
    color: #cfcfcf;
    cursor: help;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

#help-tooltip {
    position: fixed;
    top: 60px;
    right: 20px;
    padding: 10px;
    background: #333;
    color: white;
    border-radius: 4px;
    font-size: 14px;
    line-height: 1.4;
    max-width: 250px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s;
    z-index: 1000;
}

/* Show tooltip on both hover and when active class is present */
#help-button:hover+#help-tooltip,
#help-tooltip.active {
    opacity: 1;
    visibility: visible;
}

#help-button:hover+#help-tooltip {
    transition-delay: 0.3s;
}

#help-tooltip.active {
    transition-delay: 0s;
}

/* Define animations */
@keyframes fillCell {
    from {
        background-color: rgba(42, 42, 42, 0.85);
        transform: scale(0.8);
    }

    to {
        background-color: rgba(255, 255, 255, 0.95);
        transform: scale(1);
    }
}

@keyframes unfillCell {
    from {
        background-color: rgba(255, 255, 255, 0.95);
        transform: scale(1.2);
    }

    to {
        background-color: rgba(42, 42, 42, 0.85);
        transform: scale(1);
    }
}

@keyframes undoCell {
    0% {
        transform: scale(1.1);
    }

    50% {
        transform: scale(0.9);
    }

    100% {
        transform: scale(1);
    }
}

.mirror-buttons {
    position: absolute;
    right: -40px;
    bottom: 0;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.mirror-buttons button {
    width: 30px;
    height: 30px;
    padding: 0;
    background-color: rgba(58, 58, 58, 0.85);
    color: #888;
    border: 1px solid rgba(90, 90, 90, 0.8);
    border-radius: 2px;
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(3px);
    transition: all 0.2s ease;
}

/* Add specific style for rotate button */
.mirror-buttons button#rotate {
    background: none;
    border: none;
    backdrop-filter: none;
    font-size: 22px;
    /* Make emoji slightly larger */
    color: #cfcfcf;
    text-shadow: 0 0 5px rgba(0, 0, 0, 0.5);
    /* Add subtle shadow for better visibility */
}

.mirror-buttons button#rotate:hover {
    background: none;
    transform: scale(1.2);
    color: #ffffff;
}

/* Update rotating animation to work without background */
.mirror-buttons button#rotate.rotating {
    background: none;
    animation: rotate 0.5s linear;
}

.mirror-buttons button:hover {
    background-color: #4a4a4a;
    color: #e0e0e0;
}

.mirror-buttons button.active {
    background-color: #6a6a6a;
    color: #00ff00;
    border-color: #00ff00;
    text-shadow: 0 0 5px rgba(0, 255, 0, 0.5);
}

/* Add new styles for rotate animation */
.mirror-buttons button.rotating {
    animation: rotate 0.5s linear;
}

@keyframes rotate {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(90deg);
    }
}