*{margin:0;padding:0;box-sizing:border-box;font-family:system-ui,sans-serif}
html,body{
  height:100%;
  width:100%;
  overflow:hidden;
}
body{
  background:#050010;color:#e0e0e0;
  display:flex;
  flex-direction:row;
  align-items:stretch;
  gap:0;
  padding:8px;
  height:100vh;
  width:100vw;
}
.title{
  position:relative;
  font-size:15px;
  font-weight:700;
  background:linear-gradient(90deg,#a88cff,#ff88dd);
  -webkit-background-clip:text;background-clip:text;color:transparent;
  text-align:center;
  margin-bottom:4px;
}
.panel{
  background:#1a1527;
  border-radius:12px;
  padding:12px;
  display:flex;
  flex-direction:column;
  gap:6px;
  align-items:stretch;
  justify-content:flex-start;
  width:220px;
  min-width:220px;
  border:1px solid #332a50;
  flex-shrink:0;
  overflow-y:auto;
}
.group-divider{
  height:1px;
  background:linear-gradient(90deg, transparent, #332a50, transparent);
  margin:6px 0;
}
input[type="color"]{
  width:100%;
  height:50px;
  border-radius:10px;
  border:none;
  background:#2a2244;
  cursor:pointer;
}
input[type="range"]{
  width:100%;
  accent-color:#a88cff;
}
select{
  width:100%;
  padding:10px 14px;
  border-radius:10px;
  border:none;
  background:#251e3a;
  color:#fff;
  font-weight:500;
  cursor:pointer;
  transition:0.2s;
  font-size:14px;
}
select:hover{background:#3a2f5c}
select:focus{
  outline:none;
  box-shadow:0 0 0 2px rgba(168,140,255,0.3);
}
input[type="text"]{
  width:100%;
  padding:10px 14px;
  border-radius:10px;
  border:none;
  background:#251e3a;
  color:#fff;
  font-weight:500;
  font-size:16px;
  text-align:center;
  transition:0.2s;
}
input[type="text"]:hover{background:#3a2f5c}
input[type="text"]:focus{
  outline:none;
  box-shadow:0 0 0 2px rgba(168,140,255,0.3);
}
input[type="text"]::placeholder{
  color:#888;
}
button{
  padding:10px 14px;
  border-radius:10px;
  border:none;
  background:#251e3a;
  color:#fff;
  font-weight:500;
  cursor:pointer;
  transition:0.2s;
  width:100%;
}
button:hover{background:#3a2f5c}
button.active{background:linear-gradient(90deg,#a88cff,#ff77cc);color:#fff}
.label{
  font-size:11px;
  color:#aaa;
  text-align:center;
  width:100%;
}
.panel .label{
  margin-top:12px;
  margin-bottom:2px;
  font-weight:600;
  color:#c0b0e0;
  text-transform:uppercase;
  letter-spacing:0.5px;
}
.panel .label:first-of-type{
  margin-top:8px;
}
body.fullscreen{
  padding:0;
  gap:0;
  overflow:hidden;
}
body.fullscreen .main-container{
  display:flex;
  justify-content:center;
}
body.fullscreen .panel{
  display:none;
}
body.fullscreen .title{
  display:none;
}
body.fullscreen #canvasWrapper{
  width:100vw;
  height:100vh;
  border:none;
  border-radius:0;
}
body.fullscreen #canvasSquare{
  width:100%;
  height:100%;
  max-width:100vw;
  max-height:100vh;
}
#exitFullscreenBtn{
  position:fixed;
  top:20px;
  right:20px;
  z-index:1000;
  display:none;
  padding:12px 18px;
  font-size:16px;
  background:rgba(37,30,58,0.9);
  backdrop-filter:blur(10px);
}
body.fullscreen #exitFullscreenBtn{
  display:block;
}

.main-container{
  display:flex;
  flex-direction:row;
  align-items:stretch;
  gap:8px;
  width:100%;
  height:100%;
}

.panel-left{
  order:1;
}
#canvasWrapper{
  order:2;
  flex:1;
  min-width:0;
}
.panel-right{
  order:3;
}

#canvasWrapper{
  position:relative;
  border-radius:12px;
  border:2px solid #332a50;
  box-shadow:0 0 30px rgba(168,140,255,0.15);
  overflow:hidden;
  width:100%;
  height:100%;
  display:flex;
  align-items:center;
  justify-content:center;
}
#canvasSquare{
  position:relative;
  width:100%;
  height:100%;
  display:flex;
  align-items:center;
  justify-content:center;
}
#canvasSquare-inner{
  position:relative;
  aspect-ratio:1/1;
  width:auto;
  height:auto;
  max-width:100%;
  max-height:100%;
}
#bgImage{
  position:absolute;
  top:0;
  left:0;
  width:100%;
  height:100%;
  object-fit:cover;
  display:none;
  z-index:0;
}
#canvas{
  position:relative;
  z-index:1;
  width:100%;
  height:100%;
  display:block;
  background:transparent;
  touch-action:none;
}

.mobile-panel-container{
  display:none;
}

.desktop-only{
  display:flex;
}

@media (max-width: 900px) {
  body{
    padding:0;
  }
  
  .desktop-only{
    display:none !important;
  }
  
  .main-container{
    flex-direction:column;
    gap:0;
  }
  
  #canvasWrapper{
    order:1;
    border-radius:0;
    border:none;
    box-shadow:none;
  }
  
  .mobile-panel-container{
    display:block;
    position:fixed;
    bottom:0;
    left:0;
    right:0;
    z-index:100;
    transform:translateY(calc(100% - 50px));
    transition:transform 0.3s ease;
  }
  
  .mobile-panel-container.open{
    transform:translateY(0);
  }
  
  .mobile-toggle-btn{
    position:absolute;
    top:-40px;
    right:10px;
    width:40px;
    height:40px;
    border-radius:50%;
    background:rgba(26,21,39,0.95);
    backdrop-filter:blur(10px);
    border:1px solid #332a50;
    color:#fff;
    font-size:20px;
    padding:0;
    display:flex;
    align-items:center;
    justify-content:center;
    cursor:pointer;
    z-index:101;
  }
  
  .mobile-panel-container.open .mobile-toggle-btn{
    top:10px;
  }
  
  .mobile-tab-bar{
    display:flex;
    background:rgba(26,21,39,0.98);
    backdrop-filter:blur(15px);
    border-top:1px solid #332a50;
    padding:0;
  }
  
  .mobile-tab{
    flex:1;
    padding:12px 8px;
    background:transparent;
    border:none;
    color:#888;
    font-size:13px;
    font-weight:600;
    cursor:pointer;
    transition:all 0.2s;
    border-bottom:2px solid transparent;
  }
  
  .mobile-tab.active{
    color:#a88cff;
    border-bottom-color:#a88cff;
    background:transparent;
  }
  
  .mobile-panels{
    background:rgba(26,21,39,0.98);
    backdrop-filter:blur(15px);
    max-height:60vh;
    overflow-y:auto;
  }
  
  .mobile-panel{
    display:none;
  }
  
  .mobile-panel.active{
    display:block;
  }
  
  .mobile-panel .panel{
    width:100%;
    min-width:100%;
    border-radius:0;
    border:none;
    background:transparent;
  }
  
  body.fullscreen .mobile-panel-container{
    display:none;
  }
}

@media (max-width: 600px) {
  .mobile-panels{
    max-height:70vh;
  }
  
  .panel{
    padding:10px;
    gap:5px;
  }
  
  button, select, input[type="text"]{
    padding:12px 14px;
  }
  
  input[type="color"]{
    height:55px;
  }
}
