body {
  margin: 0;
  overflow: hidden; /* Hide scrollbars */
  font-family: sans-serif;
}

canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none; /* Remove border */
}

/* App header bar at the very top */
.app-header-bar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1.5rem;
  z-index: 11;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.25rem 1rem;
  backdrop-filter: blur(10px);
  -webkit-user-select: none;
  user-select: none;
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.5px;
  line-height: 1rem;
}

.rainbow-pill {
  display: inline-block;
  background-color: #000000 !important;
  padding: 0.2rem 0.4rem;
  border-radius: 8px;
  font-weight: bold;
  font-family: sans-serif !important;
  /* Black background and font are set with !important to override any theme colors/fonts */
}

.rainbow-char {
  display: inline-block;
  /* Colors are set inline to override any theme colors */
}

.header-email-link {
  color: inherit;
  text-decoration: none;
  transition: opacity 0.2s;
}

.header-email-link:hover {
  opacity: 0.7;
}

/* Toolbar at the top */
.toolbar {
  position: absolute;
  top: 3rem;
  left: 1rem;
  right: 1rem;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  align-items: center;
  backdrop-filter: blur(10px);
  -webkit-user-select: none;
  user-select: none;
  touch-action: none;
  flex-wrap: wrap;
  gap: 1rem;
  border-radius: 1rem;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.toolbar-left,
.toolbar-right {
  display: flex;
  gap: 1.5rem;
  align-items: center;
  flex-wrap: wrap;
}

.toolbar-group {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.toolbar-group-vertical {
  flex-direction: column;
  gap: 0.25rem;
  align-items: center;
}

.toolbar-label-small {
  font-size: 0.65rem;
  font-weight: 500;
  letter-spacing: 0.5px;
  opacity: 0.8;
  white-space: nowrap;
}

/* Control panel at the bottom right */
#controls {
  position: absolute;
  bottom: 10px;
  right: 10px;
  z-index: 10;
  -webkit-user-select: none;
  user-select: none;
  touch-action: none;
}

.control-panel {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1rem;
  border-radius: 1rem;
  align-items: center;
}

.color-picker {
  width: 40px;
  height: 40px;
  border-radius: 6px;
  cursor: pointer;
  border: 2px solid transparent;
  transition: border-color 0.2s;
}

.color-picker:hover {
  border-color: rgba(255, 255, 255, 0.3);
}

.slider {
  width: 150px;
  cursor: pointer;
}

.slider-label {
  font-size: 0.85rem;
  margin-bottom: 0.5rem;
  font-weight: 500;
  text-align: center;
}

.btn {
  padding: 0.6rem;
  border-radius: 0.5rem;
  cursor: pointer;
  font-size: 1.2rem;
  transition: background 0.2s;
  display: flex;
  justify-content: center;
  align-items: center;
  width: 40px;
  height: 40px;
  border: none;
}

.theme-select {
  padding: 0.5rem 0.75rem;
  border-radius: 0.5rem;
  cursor: pointer;
  font-size: 0.9rem;
  border: none;
  min-width: 120px;
}

.dpad {
  position: relative;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
}
.dpad button {
  position: absolute;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: background 0.2s;
}

.up {
  top: 5px;
  left: 50%;
  transform: translateX(-50%);
}
.down {
  bottom: 5px;
  left: 50%;
  transform: translateX(-50%);
}
.left {
  left: 5px;
  top: 50%;
  transform: translateY(-50%);
}
.right {
  right: 5px;
  top: 50%;
  transform: translateY(-50%);
}

.center {
  width: 50px;
  height: 50px;
  border-radius: 50%;
}

.btn.active {
  box-shadow: inset 0 0 3px rgba(0, 0, 0, 0.15);
}

/* Responsive design for smaller screens */
@media (max-width: 768px) {
  .toolbar {
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    top: 2.75rem;
    left: 0.75rem;
    right: 0.75rem;
  }

  .toolbar-left,
  .toolbar-right {
    gap: 0.75rem;
  }

  .slider {
    width: 100px;
  }

  .color-picker {
    width: 36px;
    height: 36px;
  }

  .btn {
    width: 36px;
    height: 36px;
    font-size: 1rem;
  }

  .theme-select {
    font-size: 0.85rem;
    min-width: 100px;
    padding: 0.4rem 0.6rem;
  }
}

@media (max-width: 480px) {
  .toolbar {
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    top: 2.5rem;
    left: 0.5rem;
    right: 0.5rem;
  }

  .toolbar-left,
  .toolbar-right {
    gap: 0.5rem;
  }

  .toolbar-group {
    gap: 0.35rem;
  }

  .toolbar-label-small {
    font-size: 0.6rem;
  }

  .slider {
    width: 80px;
  }

  .color-picker {
    width: 32px;
    height: 32px;
  }

  .btn {
    width: 32px;
    height: 32px;
    font-size: 0.9rem;
    padding: 0.5rem;
  }

  .theme-select {
    font-size: 0.8rem;
    min-width: 80px;
    padding: 0.35rem 0.5rem;
  }
}
