
:root {
    color-scheme: light;

    --bgcanvas: #efefef;
    --bgcolor: #efefef;
    --bgcolor1: #dddc;
    --bgcolor2: #cccc;

    --btncolor: #eee;
    --inputcolor: #ddd;

    --hover: #97c6cc;
    --accent1: #97c6cc33;
    --accent2: #a9bec2;

    --fgcolor: #1d293a;
    --bordercolor: #ccc;
}

/* Dark mode */
.dark {
    --bgcanvas: #666;
    --bgcolor: #333;
    --bgcolor1: #444;
    --bgcolor2: #555;

    --btncolor: #333;
    --inputcolor: #222;

    --hover: #57787c;
    --accent1: #51666933;
    --accent2: #556568;

    --fgcolor: #ddd;
    --bordercolor: #555;
}

html,body{
    padding:0;
    margin: 0;
    min-height:100dvh;
    width:100%;
    touch-action: none;
    background-color: var(--bgcanvas); /* fixed for canvas */
    color: #000;
  touch-action: manipulation;
  overscroll-behavior: none;
  user-select: none;
  overflow: hidden;
}
.noselect{
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
}
button, a, input, canvas {
  touch-action: manipulation;
}
*{
    box-sizing: border-box;
    font-family: Arial, sans-serif;
    line-height: 1.2em;
}
.box *{
  user-select: none;
  /* WebKit prefix (essential for Safari/iOS) */
  -webkit-user-select: none;

  /* Stops the long-press selection "magnifying glass" on iOS */
  -webkit-touch-callout: none;

  /* Optional: Prevents text-shadow/background color change on tap/click (iOS-specific) */
  -webkit-tap-highlight-color: transparent;
}
button.svg{
    display:flex;
    align-items: center;
    justify-content: center;
    padding:0;
}
button,select,
input[type=text],
input[type=number]
{
    padding: 6px 14px;
    border-radius: 4px;
    border: 1px solid  var(--bordercolor);
    
    color: var(--fgcolor);
    transition: background 0.2s;
}
button:active{
    background: var(--btncolor);
}
select,
input[type=text],
input[type=number]{
    background: var(--inputcolor);
}
input[type=range] {
    width: 100%;
    accent-color: var(--hover);
    border:0;
}
input[type=checkbox] {
    transform: scale(1.3);
    accent-color: var(--hover);
}
button,
input[type=color]{
    background: var(--btncolor);
}
button,
select,
input[type=color]
{
    cursor: pointer;
    user-select: none;
}

input[type=color]{
    padding:0;
    margin:0;
    border:0;
    border-radius: 4px;
    appearance: none;
    -webkit-appearance: none;
}

/* Remove the default inner square (for Chrome, Edge, etc.) */
input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 0;
  border-radius: 4px;
}
input[type="color"]::-webkit-color-swatch {
  border: none;
  border-radius: 4px;
}
/* For Firefox */
input[type="color"]::-moz-color-swatch {
  border: none;
  border-radius: 4px;
}


button[disabled] {
    opacity: 0.5;
    cursor: not-allowed;
}
button:hover:not([disabled]) {
    background: var(--hover);
}


a, a:visited, a:active{
    text-decoration: none;
    color:var(--fgcolor);
}

.qs_main {
    color: #000;
    /* border-radius: 8px; */
    padding: 0;
    max-height: calc(90vh - 330px);
    overflow: auto;
    margin-top: 100px;
    z-index:3;
    box-shadow: 0 0 10px #8888 !important;
    /* box-shadow: none !important; */
    border-radius: 0.3rem;
}
.qs_label {
    font-weight: bold;
    color: #000;
}
.boxshadow{
    box-shadow: 0 0 10px #8888 !important;
    border-radius: 0.3rem;
}

#logo{
    position:absolute;
    top:20px;
    left:20px;
    height:80px;
    background-color: #eee;
    width:200px;
    padding:8px;
    z-index:2;
}

h1,h2{margin:0.1rem 0;}
h1{font-size:1.2rem;}
h2{font-size:1rem;}


.small{
    font-size: 0.8rem;
}
.xs{
    font-size: 0.7rem;
}


.flex{display:flex;}
.flex-wrap{flex-wrap: wrap;}
.gap{gap:1rem;}
.gapS{gap:0.4rem}
.paddingS{padding:0.2rem}
.padding{padding:0.4rem}
.flex-column{
    flex-direction: column;
}
.align-center{
    align-items: center;
}
.overflowHidden{
    overflow: hidden;
}
.centervh{
    width:100%;
    height:100vh;
    height:100dvh;
    display:flex;
    align-items: center;
    justify-content: center;
    /* background-color: #fc08; */
    
}
.label{
 font-size: 10pt;
 font-weight: bold;   
}



button:hover{
    cursor: pointer;
}

#drawlayers{
    position:absolute;
}
#drawlayers canvas,
#sketch-container canvas,
#draw-container canvas{
    opacity:0;
}

#bgcontainer{
    position:absolute;
    top:0;
    left:0;
    width:100%;
    height:100dvh;
    /* background-color: #eee; */
    
}
#bgcanvas {
  width: 100%;
  height: 100%;
  display: block;
}
.zindex9{
    z-index: 9;
}
.zindex10{
    z-index: 10;
}
.zindex100{
    z-index: 100;
}

nav.top{top:0;}
nav.bottom{bottom:0;}
nav.right{right:0;}
nav.left{left:0;}
.bottomcenter{
    position:absolute;
    bottom:0;
    left:50%;
    transform: translateX(-50%);
    z-index:10;
}
nav.leftcenter{
    position:absolute;
    left:0;
    top:50%;
    transform: translateY(-50%);
    z-index:10;
}
nav.topcenter{
    position:absolute;
    top:0;
    left:50%;
    transform: translateX(-50%);
    z-index:10;
}
nav.box{
    padding:0.4rem;
    margin:0.4rem;
    background-color: var(--bgcolor);
    color: var(--fgcolor);
    border-radius: 0.4rem;
    box-shadow: 0 0 20px #0005;
}

.block{display:inline-block}


.border{
    border:1px solid var(--bordercolor);
    border-radius: 0.4rem;
}


.button2 {
    width:2.6rem;
    height:2.6rem;
}
.button3 {
    width:3rem;
    height:3rem;
}

.bold{
    font-weight: bold;
    paint-order: stroke;
}

.noshow{
    display:none;
}
#dropzone{
    width:100%;  
    height: 6rem;
    border:2px dotted gray; 
    line-height:50px; 
    text-align:center; 
    border-radius: 0.3rem;
}
#dropzone:hover{
    cursor: pointer;
}
/* range slider styles from https://www.smashingmagazine.com/2021/12/create-custom-range-input-consistent-browsers/ */
.seamless input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    background: transparent;
    cursor: pointer;
    /* margin-top:0.2rem; */
    min-width:200px;
    width:30vw;
    height:3rem;
    flex:auto;
}
.seamless input[type="range"]:active {
    cursor: grabbing;
}
/***** Track Styles *****/
/***** Chrome, Safari, Opera, and Edge Chromium *****/
.seamless input[type="range"]::-webkit-slider-runnable-track {
    background: #eee;
    height: 3rem;
    border-radius: 0.3rem;  
    box-shadow: inset 0 0 5px#ccc;
    border:1px solid #ccc;
}
/******** Firefox ********/
.seamless input[type="range"]::-moz-range-track {
    background: #eee;
    height: 3rem;
    border-radius: 0.3rem;  
    box-shadow: inset 0 0 5px#ccc;
    border:1px solid #ccc;
}

/***** Thumb Styles *****/
/***** Chrome, Safari, Opera, and Edge Chromium *****/
.seamless input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none; /* Override default look */
    appearance: none;
    margin-top: -1px;
    background-color: #ddd;
    height: 3rem;
    width: 3rem;  
    border-radius: 0.2rem;  
    outline:1px solid #888;
    

}
/***** Firefox *****/
.seamless input[type="range"]::-moz-range-thumb {
    border: none; /*Removes extra border that FF applies*/
    border-radius: 0; /*Removes default border-radius that FF applies*/
    background-color: #ddd;
    height: 3rem;
    width: 3rem;
    border-radius: 0.2rem;  
    outline:1px solid #888;
}

/***** Chrome *****/
/* width */
::-webkit-scrollbar {
width: 10px;
}
/* Track */
::-webkit-scrollbar-track {
background: #f1f1f1;
}
/* Handle */
::-webkit-scrollbar-thumb {
background: #888;
}
/* Handle on hover */
::-webkit-scrollbar-thumb:hover {
background: #555;
}

.bottomleft{
    position:absolute;
    width:200px;
    height:200px;
    left:20px;
    bottom:20px;
    z-index:3;
}
.whitebg{
    background-color: #fff;
}

.engine-panel.box {
    position: absolute;
    right: 20px;
    top: 20px;
    width: 260px;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    background-color: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(4px);
}

.engine-panel section {
    margin-bottom: 16px;
}

.engine-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.engine-panel #setupBtn {
    width: 100%;
}

#dropzone.dragover {
    background: rgba(0, 173, 181, 0.12);
    border-color: var(--hover)
}


.relative{position:relative}
.absolute{position:absolute}

#brush-container{
    display:grid;
    grid-template-columns: repeat(2, 1fr);
    gap:0.4rem;
}
#brush-container .brush-btn{
    width:4.5rem;
    height:4.5rem;
    padding:0.4rem;
}
#brush-container .brush-btn img{
    width:30px;
    height:30px;
    object-fit: contain;
    filter: invert(1);
}


button.active{
    border:2px solid var(--accent2);
    background-color: var(--accent1);
}

/* SVG */
button svg text{
    fill: var(--fgcolor);
}
button svg path,
button svg rect
{
    stroke: var(--fgcolor);
}

.pill{
  background:#fc0;
  color:#000;
  padding:0.2rem 0.4rem;
  border-radius: 1rem;
  font-size:9pt;
  text-align: center;
}
sup.pro{
    position:absolute;
    background:#fc0;
    width:8px;
    height:8px;
    border-radius: 50%;
    margin-left:2px;
    right:3px;
    top:3px;
}

#viewport, canvas, #scene {
  touch-action: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}


#bgcontainer{
    display: block;
    font-size:0;
}
#bgcanvas2{
    display: block;
    position:absolute;top:0;left:0;
}
#surface {
    position: relative; width: 100%; height: 100dvh;
    overflow: hidden; 
    pointer-events: all;
    cursor: crosshair;
    /* z-index:9; */
}
#scene {
position: absolute; top: 50%; left: 50%;
transform-origin: center center;
/* z-index:8; */
}
#layers {
position: absolute; top: 50%; left: 50%;
transform: translate(-50%, -50%);
/* z-index:8; */
}
#bgcontainer{
position: absolute; top: 50%; left: 50%;
transform: translate(-50%, -50%);
width:500vw;
height:500vh;
/* z-index:5; */
}
#draw-container{
z-index: 5;
}

.header {
    
  font-weight: bold;
  font-size:11pt;
  margin-bottom: 4px;
}


.layer-ui {
  background: var(--bgcolor1);
  color: var(--fgcolor);
  font-family: sans-serif;
  width: 220px;
  padding: 8px;
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  user-select: none;
}
.layer-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
    overflow-y: auto;
    max-height:500px;
}

.layer-bar {
  margin-top: 6px;
  display: flex;
  justify-content: space-between;
}

.layer-bar button {
  background: var(--bgcolor);
  color: var(--fgcolor);
  border: none;
  padding: 4px 8px;
  border-radius: 3px;
  cursor: pointer;
  font-size: 1.1em;
  transition: background 0.2s;
}


.layer-item {
  background: var(--bgcolor2);
  padding: 4px 6px;
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: background 0.2s, box-shadow 0.15s;
  gap:0.5rem;
}

.layer-item.active {
  background: var(--accent2);
}

.layer-item:hover {
  background: var(--hover);
}

.layer-item.dragging {
  opacity: 0.6;
}

.layer-item.drop-target {
  background: #4ea1ffcc;
}
.layer-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 10pt;
}
.layer-dragpoint {
  display: flex;
  align-items: center;
  cursor: grab;
  color: var(--fgcolor);
  margin-right: 6px;
}
.layer-item.dragging .layer-dragpoint {
  cursor: grabbing;
}

.layer-vis {
  background: none;
  border: none;
  color: var(--fgcolor);
  cursor: pointer;
  font-size: 0.9em;
  margin-left: 8px;
  transition: color 0.2s;
}

.layer-vis.off {
  color: #666;
}


input[type=number]{
    min-width: 150px;
}


/* Handle mobile device */



.margin-center{
    margin:0 auto;
}
.text-center{
    text-align: center;
}
 /* Show button on small screens */
.expandDiv{
    font-size:9pt;
    width:min-content;
    z-index:0;

}
.transform{
    transform: translate(-50px,-50px);
    position:absolute;
    z-index:-1;
}
.transform2{
    transform: translate(52px,52px);
    position:absolute;
}
.transform3{
    transform: translate(52px,18px);
    position:absolute;
}
.transform4{
    transform: translate(-13px,-28px);
    position:absolute;
}
.transform5{
    transform: translate(-13px,2px);
    position:absolute;
}
.transform6{
    transform: translate(10px,45px);
    position:absolute;
}
.transform6 img{
    width:40px;
    height:40px;
}
.expandLabel{
    display: none;
    pointer-events: none;
    user-select: none;
    font-size:20px;
    text-align: center;
    color: var(--fgcolor);
}
.margin-top{
    margin-top:0.4rem;
}


.circle-backdrop{
    user-select: none;
    display: none;
    position: absolute;
    z-index: -1;
    width: 100px; 
    height: 100px; 
    /* top: 50%; */
    /* left: 50%; */
    /* transform: translate(-50%,-50%); */
}
.circle-backdrop circle{
    fill:var(--bgcolor);
    user-select: none;
    filter: drop-shadow(0 0 2px #8888);
}

    .expand {
        /* display: none; */
        border:0;
        margin:0;
        padding:0;
        background-color: transparent;
        color:var(--fgcolor);
        text-align: center;
        cursor: pointer;
    }
    .expand:active, .expand:hover{   
        background-color: transparent !important;
    }
    .expanded {
        display: block !important;
    }
    .contract{
        z-index: 100 !important;
    }   
  @media (max-width: 850px), (max-height: 850px) {
    .circle-backdrop,.expandLabel,
    .expand {
      display: inline-block;
    }
    .contract{
        display: none;
    }   
    #content{
        display:none;
    }
    .bottomcenter{
        bottom:0 !important;
    }
    .MT{
        margin-top:2rem !important;
    }
    .MB{
        margin-bottom:2rem !important;
    }
    .ML{
        margin-left:2rem !important;
    }

    .MR{
        margin-right:2rem !important;
    }
  }

.logo{
    width:100px;
}

  #loading{
    width:100vw;
    height:100dvh;
    position: absolute;
    top:0;
    left:0;
    background-color: #fff3;
    z-index:100;
    backdrop-filter: blur(5px);
    display:flex;
    align-items: center;
    justify-content: center;
  }

.limited-ad { 
width:100%; 
max-width: 728px; max-height: 90px;
height: 90px !important; 
display: block; 
}


/* Color settings with iro.js */
#colorValues{
    user-select: text;
}

.swatchGrid {
    max-height:80%;
    overflow-y: auto;
  display: grid;
    grid-template-columns: repeat(auto-fill, minmax(30px, 1fr));
    grid-template-rows: auto;
  /* grid-template-rows: repeat(2, 28px); */
  grid-gap: 6px;
  margin-bottom: 1em;
}

.swatch {
  border-radius: 4px;
  width:30px;
  height:30px;
  cursor: pointer;
}
button#removeColor.active {
  background: #e74c3c;
  color: white;
}

.addSwatchBtn{
    border-radius: 50%;
    width:30px;
    height:30px;
    padding:0;
    font-size:20px;
}