body {
  margin: 0;
  font-family: sans-serif;
  transition: background 0.3s, color 0.3s;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #f5f5f5;
  padding: 10px 20px;
}

header h1 {
  margin: 0;
  font-size: 1.4rem;
}

main {
  display: flex;
  height: calc(100vh - 60px);
}

#blocklyDiv {
  flex: 1;
  height: 100%;
}

#stage {
  width: 480px;
  height: 360px;
  border: 2px solid #ccc;
  background: white;
  margin: 10px;
}

aside {
  position: fixed;
  top: 60px;
  right: 0;
  background: #f0f0f0;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

button, label.custom-button {
  padding: 6px 12px;
  font-size: 0.9rem;
  cursor: pointer;
  background: #007acc;
  color: white;
  border: none;
  border-radius: 4px;
  text-align: center;
}

button:hover, label.custom-button:hover {
  background: #005fa3;
}

.switch {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 24px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  transition: 0.4s;
  border-radius: 24px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: 0.4s;
  border-radius: 50%;
}

input:checked + .slider {
  background-color: #2196F3;
}

input:checked + .slider:before {
  transform: translateX(26px);
}

/* Light theme */
body.light {
  background: white;
  color: black;
}
body.light header {
  background: #f5f5f5;
}
body.light aside {
  background: #f0f0f0;
}

/* Dark theme */
body.dark {
  background: #181818;
  color: white;
}
body.dark header {
  background: #222;
}
body.dark aside {
  background: #2c2c2c;
}
body.dark button, body.dark label.custom-button {
  background: #444;
  color: white;
}
body.dark button:hover, body.dark label.custom-button:hover {
  background: #666;
}

/* Gallery preview thumbnails */
.gallery-item {
  border: 1px solid #ccc;
  border-radius: 6px;
  padding: 10px;
  margin: 10px;
  text-align: center;
  background: white;
  transition: box-shadow 0.2s ease-in-out;
}
.gallery-item:hover {
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
}
.gallery-item img {
  width: 160px;
  height: 120px;
  object-fit: cover;
  border-radius: 4px;
}
.gallery-item h3 {
  margin: 8px 0 4px 0;
}
.gallery-item p {
  margin: 0;
  font-size: 0.85rem;
  color: #444;
}
body.dark .gallery-item {
  background: #2a2a2a;
  color: white;
  border: 1px solid #555;
}
body.dark .gallery-item p {
  color: #ccc;
}
