html, body {
  -webkit-touch-callout: none; /* iOS Safari */
  -webkit-user-select: none; /* Safari */
  -khtml-user-select: none; /* Konqueror HTML */
  -moz-user-select: none; /* Old versions of Firefox */
  -ms-user-select: none; /* Internet Explorer/Edge */
  user-select: none;
}
body {
  font-family: sans-serif;
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  /*margin-top: 60px;
  margin-left: 120px;*/
  background-color: #1e1e1e;
  color: #ffffff;
}
.context {
  width: 200px;
  margin: 0;
  padding-left: 0;
  box-shadow: 0, 0, 10px, rgba(0, 0, 0, 0.1);
  background: #555;
  position: fixed;
  z-index: 9999;
  font-size: 16px;
}
.context-link {
  list-style-type: none;
  padding: 0.75em 1em;
  font-size: 0.85em;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
}
.context-link:hover {
  background: #444;
}
.titleLogo {
  font-size: large;
  font-family: Georgia, 'Times New Roman', Times, serif;
}
.sidebar {
  margin-top: 50px;
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 100px;
  background: #121212;
  display: flex;
  align-items: center;
  padding: 10px 5px;
  z-index: 10;
  box-shadow: 0 2px 5px rgba(0,0,0,0.4);
  flex-direction: column;
  grid-template-columns: 1fr 1fr;
  grid-auto-flow: row;
}
.container {
  border: 2px solid #444;
  image-rendering: pixelated;
  cursor: crosshair;
  /*background-color: #ffffff;*/
}
canvas {
  position: absolute;
  border: 1px solid #444;
  image-rendering: pixelated;
  cursor: crosshair;
  width: 32px;
  height: 32px;
  max-width: none;
  max-height: none;
  /*background-color: #ffffff;*/
}

#canvasWrapper {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  transform-origin: 0 0;
  will-change: transform;
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  overflow: hidden;
  pointer-events: none; /* Prevent interference */
}

#canvasContainer {
  position: absolute;
  transform: translate(-50%, -50%) scale(1); /* Will be updated dynamically */
  transform-origin: top left;
  pointer-events: auto; /* Allow drawing etc. */
}

button, input[type="color"] {
  padding: 10px;
  font-size: 14px;
  border: none;
  border-radius: 4px;
  background-color: #333;
  color: #fff;
  cursor: pointer;
}
button:hover {
  background-color: #555;
}
.tool-button {
  width: 40px;
  height: 40px;
  text-align: center;
}
.topbar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 40px;
  background: #121212;
  display: flex;
  align-items: center;
  padding: 5px 10px;
  z-index: 10;
  box-shadow: 0 2px 5px rgba(0,0,0,0.4);
}
.topbar-button {
  width: 160px;
  height: 40px;
  text-align: center;
}
.menu {
  position: relative;
}
.dropdown {
  position: absolute;
  top: 40px;
  left: 0;
  background: #222;
  border: 1px solid #444;
  display: none;
  flex-direction: column;
}
.dropdown button, .dropdown label {
  padding: 10px;
  border: none;
  background: none;
  color: #fff;
  text-align: left;
  width: 150px;
}

.dropdown button:hover, .dropdown label:hover {
  background-color: #333;
}
.rightbar {
  margin-top: 50px;
  position: absolute;
  top: 0;
  bottom: 0;
  right: 0;
  width: 200px;
  background: #121212;
  padding: 10px;
  display: flex;
  flex-direction: column;
  z-index: 10;
  gap: 5px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.4);
}
.rightbar-top {
  flex: 1;
  padding-bottom: 10px;
  border-bottom: 1px solid #333;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.rightbar-top label {
  display: flex;
  flex-direction: column;
  font-size: 14px;
  color: #ccc;
}
.rightbar-bottom {
  flex: 2;
  display: flex;
  flex-direction: column;
  gap: 5px;
  overflow-y: auto;
}
.layer-item {
  background: #333;
  padding: 5px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.layer-controls button {
  margin-left: 2px;
}
.bottombar {
  position: absolute;
  left: 0; 
  bottom: 0;
  height: 160px;
  width: 100%;
  background: #121212;
  display: flex;
  align-items: center;
  overflow-x: auto;
  gap: 5px;
  z-index: 10;
  box-shadow: 0 -2px 5px rgba(0,0,0,0.4);
}
.bottomsidebar {
  position: absolute;
  top: 0;
  left: 0;
  width: 120px;
  height: 100%;
  background: #121212;
  display: grid;
  align-items: top;
  padding: 0px 5px;
  z-index: 15;
  box-shadow: 0 2px 5px rgba(0,0,0,0.4);
  flex-direction: column;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: repeat(3, 1fr) 1fr;
}
.frame-thumb {
  width: 64px;
  height: 64px;
  border: 2px solid #444;
  background: #222;
  cursor: pointer;
}
.frame-thumb.active {
  border-color: #fff;
}
.modal-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0,0,0,0.5);
  justify-content: center;
  align-items: center;
  z-index: 100;
}
.modal-content {
  display: flex;
  width: 600px;
  background: #222;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0,0,0,0.5);
}
.modal-sidebar {
  width: 140px;
  background: #111;
  display: flex;
  flex-direction: column;
  padding: 10px;
}
.modal-sidebar button {
  background: none;
  border: none;
  color: #ccc;
  padding: 10px;
  text-align: left;
  cursor: pointer;
}
.modal-sidebar button:hover {
  background: #333;
  color: #fff;
}
.modal-body {
  flex: 1;
  padding: 20px;
  display: flex;
  flex-direction: column;
}
.modal-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.modal-section h2 {
  margin-top: 0;
}
.modal-actions {
  margin-top: auto;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}
.slider-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  color: #ccc;
}
.input-pair {
  display: flex;
  align-items: center;
  gap: 8px;
}
.input-pair input[type="range"] {
  flex: 1;
}
.input-pair input[type="number"] {
  width: 50px;
  background-color: #1e1e1e;
  color: #fff;
  border: 1px solid #444;
  border-radius: 4px;
  padding: 4px;
}