        #Middiv {
            background-color: #f9f9f9;
            background-image: linear-gradient(#e0e0e0 1px, transparent 1px), linear-gradient(90deg, #e0e0e0 1px, transparent 1px);
            background-size: 20px 20px;
            background-repeat: repeat;
        }
        
        .doodle-ui {
            display: flex;
            flex-wrap: nowrap;
            gap: 10px;
            align-items: center;
            justify-content: flex-start;
            margin: 10px 0;
        }
 

        .doodle-ui button {
            margin: 0;
            border: 1px solid #ccc;
            border-radius: 6px;
            cursor: pointer;
            padding: 0;
            width: 40px;
            max-height: 40px;
            transition: filter 0.2s ease;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            background: none;
        }
        
        .doodle-ui button.color-btn {
            padding: 0;
        }
        
        .doodle-ui button img {
            width: 80px;
            pointer-events: none;
            user-select: none;
        }
        
        .doodle-ui button#black {
            background-color: black;
        }
        
        .doodle-ui button#white {
            background-color: #fff;
            border: 1px solid #999;
        }
        
        .doodle-ui button#red {
            background-color: #ff1717;
        }
        
        .doodle-ui button#blue {
            background-color: #003cc8;
        }
        
        .doodle-ui button#yellow {
            background-color: #ffe600;
        }
        
        .doodle-ui button#green {
            background-color: #008232;
        }
        
        .doodle-ui button#send {
            margin-left: 8px;
            margin-right: 8px;
        }
        
        #canvas-container {
            margin-top: 10px;
            border: 3px solid #333;
            display: inline-block;
            box-shadow: 0 0 8px rgba(0, 0, 0, 0.3);
            z-index: 2;
        }
        
        .title {
            width: 80%;
            display: block;
            margin: 0 auto 30px auto;
        }
        
        #canvas-wrapper {
            display: inline-block;
            position: relative;
        }
        
        #popup-message {
            position: fixed;
            bottom: 30px;
            left: 50%;
            transform: translateX(-50%);
            background: #333;
            color: #fff;
            padding: 12px 20px;
            border-radius: 8px;
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
            font-size: 14px;
            display: none;
            z-index: 9999;
            opacity: 0;
            transition: opacity 0.3s ease;
        }
        
        #popup-message.show {
            display: block;
            opacity: 1;
        }
        
        
        .loader {
            width: 100px;
            height: 45px;
            display: inline-block;
            position: relative;
            color: black;
            border: 3px solid;
            box-sizing: border-box;
            animation: fill 2s ease-in-out infinite alternate;
        }
        
        @keyframes fill {
            0% {
                box-shadow: 0 0 inset;
                color: black;
            }
            50% {
                color: blue;
            }
            100% {
                box-shadow: 100px 0 inset;
                color: red;
            }
        }
        
        canvas {
            image-rendering: pixelated;
            image-rendering: crisp-edges;
            cursor: url("https://theostools.neocities.org/icons/cursor.png") 8 8, auto;
        }
        
        #main-canvas-row {
            display: flex;
            justify-content: center;
            align-items: flex-start;
            gap: 20px;
            flex-wrap: wrap;
            margin-bottom: 20px;
        }
        
        #tutorial-column {
            max-width: 400px;
            width: 100%;
        }
        
        .tutorial-box {
            background: #fff9e6;
            border: 2px solid #f89848;
            border-radius: 8px;
            float: right;
            padding: 15px;
            font-family: "Inter", sans-serif;
            font-size: 14px;
            box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
        }
        
        .tutorial-box h3 {
            margin-top: 0;
            font-size: 16px;
            text-align: center;
        }
        
        .tutorial-box ul {
            padding-left: 20px;
            margin: 0;
        }
        
        .tutorial-box li {
            margin-bottom: 8px;
        }
        
        .tooltip {
            position: relative;
            display: inline-block;
            border-bottom: 1px dotted black;
        }
        
        /* Tooltip text */
        
        .tooltip .tooltiptext {
            visibility: hidden;
            width: 120px;
            background-color: #555;
            color: #fff;
            text-align: center;
            padding: 5px 0;
            border-radius: 6px;
            position: absolute;
            z-index: 1;
            bottom: 125%;
            left: 50%;
            margin-left: -60px;
            opacity: 0;
            transition: opacity 2s;
        }
        
        /* Tooltip arrow */
        
        .tooltip .tooltiptext::after {
            content: "";
            position: absolute;
            top: 100%;
            left: 50%;
            margin-left: -5px;
            border-width: 5px;
            border-style: solid;
            border-color: #555 transparent transparent transparent;
        }
        
        .tooltip:hover .tooltiptext {
            visibility: visible;
            opacity: 1;
        }
        
        #bg-toggle,
        #halftone-brush,
        #eraser-button {
            width: 7.5% !important;
            padding: 0 !important;
            border: none !important;
            background: none !important;
            display: inline-flex !important;
            align-items: center;
            justify-content: center;
        }
        
        #bg-toggle img,
        #halftone-brush img,
        #eraser-button img {
            width: 100% !important;
            object-fit: contain !important;
            pointer-events: none;
            user-select: none;
        }
        
        .layers {
            display: flex !important;
            flex-direction: column !important;
            gap: 0 !important;
            margin: 0 !important;
            padding: 0 !important;
        }
        
        .layer-btn {
            all: unset !important;
            cursor: pointer !important;
            display: block !important;
            width: 100px !important;
            line-height: 0 !important;
        }
        
        .layer-btn img {
            display: block !important;
            width: 100px !important;
            height: auto !important;
            margin: 0 !important;
            padding: 0 !important;
            pointer-events: none !important;
            user-select: none !important;
        }
        
        .color-grid {
            display: grid;
            grid-template-columns: repeat(3, 40px);
            grid-template-rows: repeat(2, 40px);
            gap: 10px;
            margin-left: 10px;
        }
        @media (max-width: 768px) {
    html,
    body {
        width: 100%;
        overflow-x: hidden;
        margin: 0;
        padding: 0;
    }

    #tutorial-column,
    #gallery,
    #loader-container,
    h3:has(+ #gallery) {
        display: none !important;
    }

    #Middiv {
        display: flex;
        flex-direction: column;
        align-items: center;
        padding: 0;
        margin: 0;
        width: 100vw;
        box-sizing: border-box;
    }

    #canvas-wrapper {
        display: flex;
        flex-direction: column;
        align-items: center;
        width: 100vw;
        overflow: hidden;
    }

    #canvas-container {
        width: 90vw;
        height: auto;
        box-sizing: border-box;
        overflow: hidden;
        margin: 0 auto;
    }

    canvas {
        width: 100% !important;
        height: auto !important;
        touch-action: none;
    }

    .doodle-ui {
        flex-wrap: wrap;
        justify-content: center;
        margin-bottom: 10px;
    }

    #main-canvas-row {
        flex-direction: column;
        align-items: center;
        justify-content: center;
    }

    a[href="doodles4flick_gallery.html"] {
        display: block;
        text-align: center;
        margin: 20px auto;
        font-weight: bold;
    }
}
#gallbutt {
    text-align: center;
  cursor: pointer;
  font-weight: 600;
  color: #382b22;
  text-transform: uppercase;
  padding: 1.25em 2em;
  background: #fff0f0;
  border: 2px solid #b18597;
  border-radius: 0.75em;
  font-family: inherit;
  font-size: 15px;
  transform-style: preserve-3d;
  transition: transform 150ms cubic-bezier(0, 0, 0.58, 1), background 150ms cubic-bezier(0, 0, 0.58, 1);
  user-select: none;
  margin: 10px auto;
  display: block;
  width:30%;
}

#gallbutt::before {
  position: absolute;
  content: '';
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  background: #f9c4d2;
  border-radius: inherit;
  box-shadow: 0 0 0 2px #b18597, 0 0.625em 0 0 #ffe3e2;
  transform: translate3d(0, 0.75em, -1em);
  transition: transform 150ms cubic-bezier(0, 0, 0.58, 1), box-shadow 150ms cubic-bezier(0, 0, 0.58, 1);
  pointer-events: none;
  z-index: -1;
}

#gallbutt:hover {
  background: #ffe9e9;
  transform: translate(0, 0.25em);
}

#gallbutt:hover::before {
  box-shadow: 0 0 0 2px #b18597, 0 0.5em 0 0 #ffe3e2;
  transform: translate3d(0, 0.5em, -1em);
}

#gallbutt:active {
  background: #ffe9e9;
  transform: translate(0, 0.75em);
}

#gallbutt:active::before {
  box-shadow: 0 0 0 2px #b18597, 0 0 #ffe3e2;
  transform: translate3d(0, 0, -1em);
}

.popup-container {
  position: fixed;
  top: 0; left: 0;
  width: 100vw; height: 100vh;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex; justify-content: center; align-items: center;
  z-index: 1000;
}

.popup-box {
            background: #fff9e6!important;
            border: 2px solid #f89848;
            border-radius: 8px;
            padding: 15px;
            font-family: "Inter", sans-serif;
            font-size: 14px;
            box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}
.popup-box button {
  margin: 5px;
  padding: 5px 10px;
}
#clear-button {
  margin-right: 15px;
}

.popup.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.popup.overlay.show {
  display: flex;
}

.popup-modal {
  background: #fff;
  color: #000;
  padding: 20px;
  width: 90%;
  max-width: 420px;
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
  animation: popupScale 0.15s ease-out;
}

.popup-modal h3 {
  margin-top: 0;
  margin-bottom: 10px;
}

.popup-modal input,
.popup-modal textarea {
  width: 100%;
  box-sizing: border-box;
  margin-bottom: 10px;
  padding: 8px;
}

.popup-buttons {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

@keyframes popupScale {
  from {
    transform: scale(0.95);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

